Record changed by another user message

mcgraw

Registered User.
Local time
Today, 08:16
Joined
Nov 13, 2009
Messages
77
I have a field called status, and on the "After Update" Event procedure, if the status = closed or iATO a separate form pops up asking for what date the system will expire.

The pop up works great, but when you go to close the main form, you get a message "The record has been modified by another user, if you save the record you will overwrite the changes the other user made." So, if I hit save, the expiration date dissapears.

What is causing the message? The expire date isn't on the main form. How can I make it so that this conflict doesn't happen?

Here's the code for the after update
Code:
Private Sub Status_AfterUpdate()
On Error GoTo errline
Select Case Me.Status
   Case "Unfunded", "Cancelled"
        Me.close_dt = Now()
   Case "Closed"
        Me.close_dt = Now()
        DoCmd.OpenForm "frmExpire", acNormal, , "ID=" & Me.ID
   Case "iATO"
        DoCmd.OpenForm "frmExpire", acNormal, , "ID=" & Me.ID
   Case Else
        Me.close_dt = Null
End Select

And here's the code for the pop up form:
Code:
Private Sub Command1_Click()
If IsNull(Me.expiration) Then
MsgBox "Please enter a System Expiration Date.", vbOKOnly, "Required Data"
End If
DoCmd.Close
End Sub

Thanks
 
If you have two forms bound to the same table or query you will have to issue a save before opening the other form.
 
Thanks for the reply. I tried putting in DoCmd.Save before the openform, and got the same error. When I googled the docmd.save syntax, it apparently only saves changes to to form, and not the current record?

How do I tell it to save the record prior to opening the new form?

And I'm assuming I would want to do the same thing before closing the pop up form as well.

Thanks for the help!
 
NEVERMIND. Google is a wonderful thing. :-)

I put a
Code:
If me.Dirty Then me.Dirty = False

In right before the openform.

THANKS!
 
What if you get error 2455, "You entered an expression that has an invalid reference to the property dirty"?

mafhobb
 
What if you get error 2455, "You entered an expression that has an invalid reference to the property dirty"?

mafhobb

So, what code did you use exactly and where did you put it? Did you put it in the VBA window and not the property dialog box?
 

Users who are viewing this thread

Back
Top Bottom