Check box/Text Box in a subform

G

Guest

Hi,
I have a check box in a subform called 'UA' and a text box called
'date_assessed'

I'd like to have date_assessed invisible until the user checks UA. I've
tried some of the suggestions on here, but I can't seem to get it an entirely
working.

The default state should be UA is unchecked and date_assessed. Once UA is
checked the text field should appear. Here's some of the code I have so far.

Private Sub Form_Current()
If Me.ua = -1 Then
Me.date_assessed.Visible = True
Else
Me.date_assessed.Visible = False
End If

End Sub

Any help would be greatly appreciated.
Thanks
Manoli
 
G

Guest

The only thing I see missing is accounting for new records. Here is what you
want to do.
In design view, set ua's default value to False and set date_assessed's
visible property to No.

Then change your Current Event code to deal with a new record:

Private Sub Form_Current()

If Me.NewRecord Then
Me.ua = False
Me.date_assessed.Visible = False
Else
Me.date_assessed.Visible = Me.ua
End If


End Sub
 
G

Guest

Thanks so much! That worked. The only thing that it doesn't do is when I
check UA, I'd like it to refresh and show the box either On Click or
something like that.

How do I do that?
Thanks again,
Manoli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top