![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
![]() |
![]() |
|
June 12, 1998   |   Back to Microsoft Access Tips | |
Synchronize Forms by Using the wherecondition Argument of the OpenForm MethodCharlie Kindschi If you’re setting up your custom Microsoft® Access application such that the user will be able to open one form from another, related form it is necessary to synchronize the data in both forms. For example, imagine that you add a new command button to the Customers form and program this button to open the Orders form. The Orders form must automatically display data for the customer currently selected on the Customers form. As the user moves from one record to the next on the Customers form, the data on the Orders form must change accordingly. Use the code examples provided in this tip to synchronize the data displayed on the Customers and Orders forms, just as if the latter were a subform of the former. Note: This technique doesn’t work both ways; one form must drive the other.
|
![]() |
|
|
![]() |
|
The wherecondition argument of the OpenForm method (for the DoCmd object) can be any valid SQL Where clause without the word "Where". You use wherecondition in the Click and Current event procedures to synchronize the Customer ID field of the query "OrderQry" (which generates the data displayed on the Orders form) with the Customer ID field on the Customers form. The Current event of the Customers form occurs whenever this form is refreshed or requeried. You use the IsLoaded function to detect the presence of the Orders form. If the form is found, the wherecondition argument is used as explained earlier. ![]() Synchronized data on the Customers and Orders forms |
© 1998 Microsoft Corporation. All rights reserved. Legal Notices. Last Updated: March 3, 1998
|
||
Best experienced with![]() Click here to start.
|
||
![]() |