Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

MS Access 2003 load subform on Tab Click

I have a form with 4 page tabs on it.

I want to load the subforms on ONE of the tabs ONLY when the Tab itself (pgVisits) is clicked.

Any ideas?
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Save your form with the subform's Filter property set to something that returns no rows.

Then write VBA in  your tab control's Change event...

Select Case Me.the_tab_control.Value
      Case 0 ' The ordinal number of the tab you're talking about, starting with 0 on the left
            Me.your_subform.Form.RecordSource = "Something that returns data"
            Me.your_subform.Form.Refresh
End Select

btw there will likely be a couple of different methods to pull this off.
This might be possible by placing blank subform controls on your tabs and setting the SourceObject property of those controls on the click events of your tab pages:

Me.SubformControlName.SourceObject = "subfrmMySubformName"
Avatar of Larry Brister

ASKER

Going to try both suggestions

May take me a few hours to get back to you
I'd start with Miriam's blank subform, which will take less overhead when the form starts up then forcing the loaded one to execute it's Record Source SQL.

Then VBA code in the tab's Change event to load it up.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America 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
Gonna try them all folks...will take a few hours
Got 180 end users saying their screens arent the right shade of blue. ;-)
This was the best answer for what I needed guys