Discussion Locked

ACCESS MACRO2000: SYNCRONIZING 2 FORMS

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How do I syncronize two forms so that when one opens it opens the other to show the relevent records according to the key fields between them:
I used:
[Customer ID]= Forms![PetsForm]![Customer ID]in the where condition of the macro, OpenForm Customer and I run it
It asks me for the parameter value?

6 replies

by cryingdragon

I'm not sure if you can link the forms,
however, the PetsForm![Customer ID]
should be placed into a table. Link the
[Customer ID] in Form1 to the Customer
ID column in the PetsForm Table.

Hope this helps.

Mike

by dmiles

1)Open the NORTHWIND.MDB database
2)Click Forms under Objects,and then click new.In the New Form dialog bopx,select Design View from the upper list and Products from the Choose The Table Or Query Where TheObjects's Data Comes From drop-down list.Save the form as frmComboTest
3)Right-click the form, and choose Properties from the shortcut menu.Set the form's Default View property to Single Form
4)Add an unbound combo box by using the Control Wizard.(To use the Control Wizard,make sure that the Control Wizard's button is pressed in on the toolbox before you create the combo box)
a. Click the Find A Record On My Form Based On The Value I Selected In My Combo Box button and then click next.
b.Include the ProductID and ProductName fields,and then click next
c.Click Finish
When you open frmComboTest and select a product name from the cboLookup combo box,the filter is set to that value

by mcthaker

The easiest way would be to have the second form inserted as a sub-form in the first and linking the master/child fields.
Way1:
The other way would be to have a "ON OPEN" event/macro which filters the records based on a field in the first form.Private Sub Form_Open(Cancel As Integer)
DoCmd.ApplyFilter , wherecondition
End Sub

NB: You may also want to put in additional code to check if the first form is actually open in this case.

Way2:
Use a button on the first form to open thesecond form:
docmd.OpenForm formname,,,wherecondition
(wherecondition would be eg:
1)for text fields:
"[field] = '" & form![fieldname] & "'"

2)for numeric fields:
"[field] = " & form![fieldname]

This discussion is closed to new replies.