I have never programmed in VBA, but ...

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

Guest

I need help

I have a form named "Flight Roster" that has a subform named EPR which has a
textbox named PreviousCloseout. On the "On Enter" event of the subform I
want to define an If Then statement in VBA to check to see if the date it
contains is < the current date. If it is, then I will run a message box to
see if the user wants to automatically update it or not. The problem I run
into is to how to properly define the form object PreviousCloseout in VBA.

I've tried many different versions but I can't figure it out.

Obviously things like the following with many variations don't work.

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

Please help me out. I have the rest of code working fine, I just need to
figure out how to define that form.subform.textbox in vba when the event is
on the subform.

Thanks
Dan
 
Strike Eagle said:
I need help

I have a form named "Flight Roster" that has a subform named EPR which has a
textbox named PreviousCloseout. On the "On Enter" event of the subform I
want to define an If Then statement in VBA to check to see if the date it
contains is < the current date. If it is, then I will run a message box to
see if the user wants to automatically update it or not. The problem I run
into is to how to properly define the form object PreviousCloseout in VBA.

I've tried many different versions but I can't figure it out.

Obviously things like the following with many variations don't work.

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

Please help me out. I have the rest of code working fine, I just need to
figure out how to define that form.subform.textbox in vba when the event is
on the subform.

Thanks
Dan

Probably:

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

Or, more simply:

If Me!EPR.Form!PreviousCloseout < Date Then

Basically, you need to refer to the Form property of the subform control.
 
Baz said:
Probably:

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

Or, more simply:

If Me!EPR.Form!PreviousCloseout < Date Then

Basically, you need to refer to the Form
property of the subform control.

This is code that would be used in the main Form's module, e.g., an event of
the Subform Control. If the code is in an event of the Form embedded in the
Subform Control, it can be even simpler:

If Me!PreviousCloseout < Date Then

Best of luck with your project.

Larry Linson
Microsoft Access MVP
 
Back
Top