Share via

Conditional Visibility Based on Date

Anonymous
2017-10-06T23:02:44+00:00

I have a few questions regarding having Access form fields conditionally visible:

  1. I would like to make a field only appear if the Date of Birth field indicates the individual was born before 01/01/1991, but I can't seem to get a condition based on a date to work correctly (it always appears regardless of the date in the Date of Birth field).
  2. I can't seem to get date fields that conditionally appear based on another field to permit data entry. I used the code below.
  3. I also can't get check boxes that conditionally appear based on another field to permit data entry. I also was using the code below.

If STATUS.Value = "SUBSTITUTION" Then

    Me.OFF_SUSPENSION.Visible = False

End If

I am using Access 2007-2010

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

ScottGem 68,830 Reputation points Volunteer Moderator
2017-10-07T02:10:45+00:00

First, youu need to understand you don't have fields on a form, you have controls that may or may not be bound to fields in a table. This is a subtle but important distinction.

  1. In both the On Current event of the form and the After Update event of the DOB control you would include a line of code like:

If Me.datecontrol < #1/1/91# Then

     Me.othercontrol.Visible = True

Else

     Me.othercontrol.Visible = False

End If

This could be shortened to:

Me.othercontrol.Visible = Me.datecontrol <#1/1/91#

  1. To allow a field to have data entered, they need to be bound to a field in a table.

3. same answer as 2

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2017-10-12T14:52:58+00:00

    Thank you! I thought I had them bound to a field, but I must've done something incorrectly. I removed them and re-added them and it worked like a charm!

    Was this answer helpful?

    0 comments No comments