Problem with linked forms

  • Thread starter Thread starter Noel
  • Start date Start date
N

Noel

Hi. Im having a problem when I use a Command button on
one form to open a linked form. I have two fields that
are common to both forms and when I update them in one
form, they are not showing immediately in the other.
Heres a fuller description.

Say I have Form1 with six fields and Form2, linked to
Form1 using an ID field, with eight fields. Two of the
fields are common to both Form1 and Form2. Each form has
its own 'internal' query. The reason I have two of the
common fields showing in Form1 is to give the users a
preview of the information they can see and edit when
they click on the button to open Form2. I also want the
users to be able to enter data in these two fields in
either form.

Whats happening is that, when the users enter data in
either of these two fields in Form1 and click on the
command button to open Form2, the data isnt showing. The
only way to see in in Form2 is to close Form1 and re open
it, then click the command button again. Also if the
users input data in either of these two fields in Form2,
it is immediately visible in Form1. Perhaps this is
because Form2 is being closed at this point, whereas
Form1 is not being closed when the command button is
clicked to open Form2.

I have set some Events in Form2 to get it to requery On
Open, On Current and On Get Focus but this doesnt work.
Is there any way that I can set it so that users can
input data in either form or am I stuck with them only
being able to do this in Form2, with Form1 just showing
an unupdatable view of the data. This would be OK but not
ideal. Thanks, Noel
 
Hi Noel,
Have you considered saving Form1 in the OnClick
event of the button? Once the data entered into Form1 is
saved, it should be available for Form2.

The Easy Day
 
Hi and thanks for this. Hmmm, Im not sure what you mean by
saving the form. Presumably thats what happens when you
close a form, you save the data entered into it at that
point, but not before. If so, what would the code look
like in the event code? Seems thats just what I want.
Thanks again, Noel
 
You have to save the data from form 1 before it will show up in form 2.
In the code for the button add a line:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Ragnar
 
Back
Top