Comparing dates on a single form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello there,

This is what I am trying to do:

Restrict the form so that the “Date 1†cannot be populated until the “Date
2" is greater than, or equal to the "Date 3".

Any help will be appreciated.

Thanks
 
AccessDeveloper said:
Hello there,

This is what I am trying to do:

Restrict the form so that the "Date 1" cannot be populated until the
"Date 2" is greater than, or equal to the "Date 3".

Any help will be appreciated.

Thanks

Disable the Date1TextBox by default in Form design. Then create the
following function in your Form's code module.

Function EnableDate1()
Me.Date1ControlName.Enabled = (Me.Date2ControlName >=
Me.Date3ControlName)
End Function

In the AfterUpdate event of both Date2 and Date3 TextBoxes enter
"=EnableDate1()". (no quotes)

You might also need to call the function in your Form's Current event.
 
I have an issue and I failed to mention earlier that my form is tabular and I
think this logic is failing.
 
AccessDeveloper said:
I have an issue and I failed to mention earlier that my form is
tabular and I think this logic is failing.

In what way is it failing? The fact that you are using a continuous form
should not matter except that as you move from record to record you will see
the Enabled/Disabled property change on all records based on the values in
the current record.
 
Back
Top