Help with VBA If statement

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

Guest

I asked this question already but the help did not work.

I have a Form named "Flight Roster", it has a tab control that goes to a
subform named EPR, in the subform their is a textbox that has a date called
PreviousCloseout.

On the On Enter event of the subform named EPR, I want to have a VBA If Then
Else statement to use the vbyes function of a message box to update the date
automatically if the date is less than the current date.

I have never programmed in VBA before so please be as detailed as possible.

I have tried:

If Forms![Flight Roster].Form.EPR.SubForm!PreviousCloseout.Value < Date

If Forms![Flight Roster].EPR!PreviousCloseout.value < Date

If [Flight Roster].EPR.subform.PreviousCloseout.value < Date

If PreviousCloseout < Date

If EPR.form!PreviousCloseout.value < Date

Any many more variations but it always fails at this line.

A previous response recommended the following but none of them worked.

If Forms![Flight Roster]!EPR.Form!PreviousCloseout < Date
and
If Me!EPR.Form!PreviousCloseout < Date

Also what does "Me" mean in VBA

Please help

Thanks
Dan
 
Forms![Flight Roster]!EPR.Form!PreviousCloseout is correct, assuming that
the control in which the subform exists is named EPR.

Don't confuse the name of the form being used as the subform with the name
of the control on the main form that holds the subform. Depending on how you
created the subform, the two names may or may not be the same.
 
Back
Top