Link to home
Start Free TrialLog in
Avatar of nomar2
nomar2

asked on

Tabbed Pages in Access - How to refer to controls on tabbed pages or refresh a tabbed page Access 2010 VBA

Using Access 2010 ,I had 3 separate forms in a database. All was working fine.

Then it was suggested to me that I should use Tabbed Pages for better navigation.

However in so doing this, some of my functionality has gone off the rails.

I created a New form called frm_main. Then on that form I added a Tab Control called TabCtl0.

On that TabCtl0, I have 3 pages. So I basically dragged and dropped the 3 forms on it's own pages.

So far so good, until I started testing some things.

For instance, on Accounts form I had a lookup combobox  that you enter a value and the record is returned on the screen..

The code I had was on the afterUpdate event was

    Dim lnSearchID As Long
    lnSearchID = cmbo_Search.Column(0)
    DoCmd.OpenForm "frm_Master", acNormal, , "l_ID = " & lnSearchID

But now that form "Frm_Master" is sitting on a page on a tabbed control.

How would I get the form to reload and return the correct record? In other words if that form is now on a another form sitting in a tabbed control, on a page??

Another example is on the form load of another form..I have a subform where a field refers to a date selected on the main form

Batch = Forms!frm_invoiceBatch!txt_ID.Value

The error is can't find referenced form "frm_InvoiceBatch", which tells me I need to refer the tab control, then page , then form..just not sure what the syntax would be.

All this worked till I moved the form to the tabbed pages

Any insight or direction would be much appreciated.
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

This is why you can't just "Drop" forms onto subforms/tabcontrols without understanding "Object Referencing"

There are a lot of possible unknowns here...

Can you post an example db that exhibits this issue?
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nomar2
nomar2

ASKER

Used ...
=[Forms]![frm_Main]![Invoices].[Form]![txt_BatchDate]

Just a matter of figuring out the Parent form and subform

Also used  Me.RecordSource = "Select * from tMaster where l_ID = " & lnSearchID  which reloaded the subform to the selected record in the dropdown box