Record sync between forms (NOT master and sub-forms)

C

Cindy

Hi everyone, and thanks in advance for any assistance you might be able to
provide. Relevant details are Access 2000 at SR-3.

MS Access 2000 supposedly gives you the ability to move between records on a
form, and automatically view related records on a second form. This is
different from having a master form and a sub form.

You can synchronize records between two forms by creating a command button
that opens and synchronizes a second form (this appears to be a static
display and does not update when to move the a new record on the main form,
only when you close and reopen), OR by using the Current event to display
related records on the second form when you move between records on the
first form. The Current event is supposed to run a macro or event when the
focus moves from one record (not field) to another.

The instructions for creating the macro to synchronize records in two forms
as you scroll through records are:

1.. Open the first form in Design view.
2.. Create a macro.
3.. In a blank action row, click OpenForm in the action list.
4.. Set the Form Name argument to the name of the second form, and then
set the Where Condition argument to display the related records you want in
the second form.
5.. In form Design view, set the OnCurrent event property of the first
form to the name of the macro.

I have followed all the instructions to the letter, however while the second
form opens and synchronizes to the current record on the first form, it does
not update/change to reflect moving through records on the first form i.e.
it does not "display related records in one form as you move between records
on another form" as the Help section states.



Many thanks, CIndy.
 
A

Arvin Meyer

I tried something similar using code and it worked fine:

Private Sub Form_Current()
DoCmd.OpenForm "frmSales", , , "PersonID=" & Me.txtPersonID
End Sub

where frmSales is the form to sync up and and PersonID is the sync'd field
in the underlying tables. PersonID in tblSales (the underlying table in the
frmSales form) is a long integer. txtPersonID is the name of the text box in
frmSales PersonID in the calling form is an autonumber.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
R

ramkay

In your Macro, insert one line before the OpenForm action. Enter the
action Close and choose Form object and the name of your second form
in the Arguments pane. Your Macro will now contain two lines: Close
and OpenForm. Now the records in the two linked forms will stay
synchronized.
 

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

Top