Subform, how do I populate only when clicking on tab

  • Thread starter Thread starter Denise
  • Start date Start date
D

Denise

Please explain how to populate the record source of the subform when the user
clicks on the tab.
 
Look for the tabCtl object, and in the change or click event, enter:

dim strsql as string
If [your tabCtl Name].value = [the tabnumber that holds your subform] Then
strsql = "SELECT * from [yourtable that is the source of the subform]"
' if there are Where conditions, add them to the sql string also

Me!yoursubfrmName.Form.RecordSource = strsql
Me!yoursubfrmName.Form.Requery
End If

Tabs are usually zero-based, so the first tab is 0, then 1, etc.

Damon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top