Pop Up form fails to update underlying form

O

ortaias

The pop up form normally works as expected in updating the underlying
form. However, there is an issue. The pop up form is linked to a
control and displays the drop-down-list in a much-improved format. The
problem occurs when one changes another control on the form and then
attempts to use the pop up form. Under that scenario, the pop up form
won't update the control it is linked to. Additionally, I noticed that
if I try to move to a different record, I receive the error message
"write conflict, another user has changed the record". It would appear
that ACCESS does not believe that the same user is using both forms.

This problem can be partially resolved by making the underlying form's
edit property to locking the current record. This doesn't update the
control. The good news is that I do not get the "write conflict" error
message. Additionally you can see that the pup up form did not work
since it won't accept your clicks. Changes to other controls continue
to work as expected. Until this problem is solved I can add a note to
the pop up form advising the user not to click on another control after
activating the pop up form.

I attempted to solve this problem through a save the underlying form
command when closing the pop up form and requerying the linked control.
This didn't work.

In summary, the pop up form works just as long as you do not make other
changes to the form. Any reason why changing another control would
prevent the pop up form from working correctly? What would be the
solution?
 
A

Allen Browne

Naturally enough, if the first form is dirty at the time when you pop up
your 2nd form and you edit the same record there, you will get the conflict
dialog.

You worked around the issue by setting the first form's properties so
editing is not possible there. You could also avoid the situation by saving
any changes in the first form before opening the popup, e.g.:
If Me.Dirty Then Me.Dirty = False
DoCmd.OpenForm "MyPopup", WindowMode:=acDialog

But, as you found, the problem still arises where 2 copies of the same data
is shown in different forms at once. Particularly if memo fields are
involved, this can be hard to avoid. You might be able to solve the issue by
binding the first form to a query that excludes the memo fields, so they are
in the 2nd form only.

The other alternative is to make the 2nd form unbound. When it pops up, it
reads the values from the first form's controls into its controls. When you
click the Ok button, it writes the values back into the first form's
controls (if there were any changes.) Since it was not actually bound to
anything in the first place, you avoid the whole scenario of Access trying
to manage simultaneous editing in multiple copies of the data.

At the very simplest level, that's what the Zoom Box does. You can press
Shift+F2 in any control (including those bound to a memo), and edit the data
in the pop-up without triggering concurrency errors.
 
O

ortaias

I went in to work, anyway. Your suggestion worked. Adding the>> If
Me.Dirty Then Me.Dirty = False << Code fixed the problem.

Private Sub Command350_Click()
On Error GoTo Err_Command350_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.Save
If Me.Dirty Then Me.Dirty = False

stDocName = "paperpopupfrm"
stLinkCriteria = "[projectnum]=" & Me![Text119]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit, acDialog

Exit_Command350_Click:
Exit Sub

Err_Command350_Click:
MsgBox Err.Description
Resume Exit_Command350_Click


End Sub
 

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