Group:  Microsoft Access ยป microsoft.public.access
Thread: I have never programmed in VBA, but ...

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

I have never programmed in VBA, but ...
Strike Eagle 16.09.2006 08:47:01
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
Re: I have never programmed in VBA, but ...
"Baz" <bazz[ at ]REMOVEbcap.THEeuro1net.CAPScom> 16.09.2006 09:11:06

"Strike Eagle" <StrikeEagle[ at ]discussions.microsoft.com> wrote in message
news:DC81E3C9-06E0-4755-B504-4DDE8974EE50[ at ]microsoft.com...
[Quoted Text]
> 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.



Re: I have never programmed in VBA, but ...
"Larry Linson" <bouncer[ at ]localhost.not> 19.09.2006 16:03:55
"Baz" <bazz[ at ]REMOVEbcap.THEeuro1net.CAPScom> wrote

> 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


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net