Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Synchronizing open subform with form

Status
Not open for further replies.

xaos

IS-IT--Management
May 22, 2002
6
0
0
US
Can anyone tell me right offhand what the code for causing a popup subform to update automatically when the record is changed on the main form... i.e, when you open the popup subform, users want to be able to scroll through records on the main form and have the subform scroll with it. I've seen this before, just can't remember the exact coding for it.
 
If you have a sub form poping up and it is not in a main form then it is not a subform.

forms![formname]![subformname].requery
me![subformname].requery


DougP, MCP
 
Assuming the popup forms name is frmPopup, then issue the following sort of command from within the OnCurrent event of the form that you wish the popup to sync to:

[tt]
WhereCond = "Surname = '" & me!Surname & "'"
Forms("frmPopup").RecordSource = "SELECT * " & _
"FROM tblWhatever " & _
"WHERE " & WhereCond
[/tt]

In the above example, I'm building the criteria WhereClause associated with the popup's recordsource, from associated information in the main form. This is then being used to regenerate the Recordsource associated with the popup form.

Ensure that the popup form is already open before applying this code.

Adapt this code as is applicable to your situation (ie. formname, WhereCond)

Hope this helps,
Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top