write conflict

Nirious

Registered User.
Local time
Today, 21:38
Joined
Jul 31, 2004
Messages
106
Yeah figures, now I was so close to finishing this thing, now I get this error:

Write conflict

"This record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes the other user made.
etc..."

I get three options: Save record,copy to clipboard, drop changes

All is ok if you press save record.But it's really annoying to always have to do that :mad:

I have the following code put behind a printbutton:
Code:
Private Sub cmdFactAfruk_Click()
On Error GoTo Err_cmdFactAfruk_Click
    Dim mijnrs As Object
    'This is the one causing the problem, if I remove this, everything is fine
    Set mijnrs = CurrentDb.OpenRecordset("SELECT * FROM facturen WHERE factuurnr = " & Me.factuurnr)
    mijnrs.MoveFirst
    mijnrs.Edit
    mijnrs!datum = Me.datum
    mijnrs!korting = Me.korting
    mijnrs!betaalwijze = Me.betaalwijze
    mijnrs!Betaalbaar = Me.Betaalbaar
    mijnrs.Update
    Set mijnrs = Nothing
    
    If afgedrukt = False Then
        DoCmd.SetWarnings False
        DoCmd.OpenQuery "FArtikelsPreparatie", acViewNormal
        DoCmd.SetWarnings True
    End If

   
    cmdCN.Enabled = True
    'calls a printer dialog window I made
    DoCmd.OpenForm "PrinterDialog", acNormal, , , , acDialog, "Fact"
    Me.afgedrukt = True
Exit_cmdFactAfruk_Click:
    Exit Sub

Err_cmdFactAfruk_Click:
    MsgBox Err.Description
    Resume Exit_cmdFactAfruk_Click
    
End Sub

I have found the error I get to be number 7787, with a response of 1

PLz, help me.
I already tried it with a query and I get the same result as putting it in code.
And I really don't get it cause there is only one user at the moment :confused:

The form that the button is on is linked to table "facturen"
the report that is being printed is linked to a query which "facturen" is a part of.
 
Last edited:
Try puting in a DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 after you have updated the record
 
Pat Hartman said:
You are conflicting with yourself. This problem occurs whenever you use bound forms and run update code in the form that updates the current record.

You can try saving the current record BEFORE you run the update code.

DoCmd.RunCommand acCmdSaveRecord

Livvie:
NEVER use
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Use the command above. This is code left over from A95. That was 4 versions ago!

Thanks Pat
 
That was a great help!

Thats the first time an old forum answer has solved my access problem, thankyou!
 

Users who are viewing this thread

Back
Top Bottom