Tab Control Referencing

dazstarr

Registered User.
Local time
Today, 20:15
Joined
Mar 19, 2007
Messages
132
Hi

Can someone help me with this please - it's pretty simple I think!

I have a form called frmPupils, on the form is a tab control called TblCtl15, on the tab control there is a sub form called subPersonalDailySchedule. I have a field on there called TripPrice.

What I would like to do is reference the TripPrice field from the main parent form (frmPupils).

Please can someone tell me what the correct syntax is in VBA. I have tried loads of variations but keep getting random error messages.

A simple message box is all I am after with the value in the TripPrice in.

Many Thanks in advance
Daz
 
I have a Form WorkOrders with a SubForm tblInvoiceDetails containing a Field called BatchID, that is referenced in VB Code as:
Forms!fmrWorkOrders!tblInvoiceDetails.Form!BatchID
I think that would make yours something like:
Forms!frmPupils!subPersonalDailySchedule.Form!TripPrice
Note that subPersonalDailySchedule represents the name of the control on Form frmPupils, not the name of the Form that is attached to the Tab. If the Control name differs, use that instead.
 
Last edited:
MSAccessRookie - I love you!

That works a treat. I was ripping my hair out trying to get that right.

Many thanks for your help!! :)

Daz
 
I think that would make yours something like:
Forms!frmPupils!subPersonalDailySchedule.Form!TripPrice

Hehehe ... hey dazstarr, don't be confused because we simultaneously posted with two different proposals because they aren't that different.

My reference of Me! should be equivalent to Forms!frmPupils!, so either should work.

-dK
 
Thanks dk

They both work!

Thanks alot for your help. I really appreciate it!

:)
 
Hehehe ... hey dazstarr, don't be confused because we simultaneously posted with two different proposals because they aren't that different.

My reference of Me! should be equivalent to Forms!frmPupils!, so either should work.

-dK

You are correct about that. The Abbreviated Naming Convention works the same way most of the time. When I looked A little closer at my program, I realized that the VB Code was actually executed in different Module called ProductionBase, and therefore the full naming convention was required for me.
 
Ah ... I just used the Me! because the reference sheet I posted (thanks Bob!) used the Me!

I normally follow the longer form just so I don't get all cornfuzzled when I am reading my own code.

I posted the clarification just in case dazstarr was all :confused:.

-dk
 
Thanks dk - i do get easily confused - espy late on a Friday afternoon!!

Hehe
 
MSAccessRookie - I love you!

That works a treat. I was ripping my hair out trying to get that right.

Many thanks for your help!! :)

Daz

My Pleasure DazzStar, but remember that there is usually more than one way to complete any task in Access,so never be surprised if more than one person offers assistance and they do not seem alike. I always ask about differences, to help me to choose the suggestion that is best for me. :D
 
Ah ... I just used the Me! because the reference sheet I posted (thanks Bob!) used the Me!

I normally follow the longer form just so I don't get all cornfuzzled when I am reading my own code.

I posted the clarification just in case dazstarr was all :confused:.

-dk

Just an FYI -

There are times, where if the code is on the form being referenced, you will get an error if you use the full qualified reference (Forms!YourFormName.Whatever) instead of using Me.

Now, just so you know - there is a difference between

Me.

and

Me!

The Me! is late binding and will typically refer to a collection (in this case usually a field in the form or report) whereas Me. is early binding and will typically let you refer to the controls on the form or report.
 
Thanks Bob - some really useful info on here.

Thanks to you guys.

I am now 1 hour away officially from beer time!! :)
 

Users who are viewing this thread

Back
Top Bottom