Yes/No Check Boxes - Default Value

A

adrian007uk

Hi I am having a problem with a yes/no option on a form. I have two fields
and i am wanting to relate them to each other. The first is called 'signed'
and is the yes/no field. The second is 'signed information' and this is a
text field. I have some code (kindly supplied by a contributor on here) that
makes the 'signed information' field visible if 'signed' is checked. This
has been entered in 'after update':

Private Sub Signed_AfterUpdate()
If Me.Signed = True Then
Me.Signed_Information.Visible = True
Else
Me.Signed_Information.Visible = False
End If
End Sub

The code works great but when i enter a new record the form repeats what was
entered into the previous record (i.e., if 'signed' was checked 'signed
information' is visible). How can i make the default value set as 'No' and
keep 'signed information invisible unless 'signed' is checked?

I have tried setting the default value in the table and from the control on
the form to 0 but this does not seem to have any effect.
 
R

Ron2006

You need to perform the exact same test:

If Me.Signed = True Then
Me.Signed_Information.Visible = True
Else
Me.Signed_Information.Visible = False
End If


in the OnCurrent event of the form.

In general, any types of logic that you have that controls color or
visibility or enableness of fields based on a change in value of
another field on that same record needs to either be done in the
onCurrent event or sometimes in the conditional formating of the
field.

Visibility must be in the oncurrent, the others that I mentioned can
be done in the conditional formatting.

Ron
 

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