Link to home
Start Free TrialLog in
Avatar of whitesandsbeach
whitesandsbeach

asked on

Record Lock Problem

Hi Experts:

I'm using the following code which works okay except that after you access a record once and quit, then access that same record again, it's locked like it is suppose to be, however, if you click the save button you get a message box that says the save command is not available, however, you can then edit the record, in other words, it is no longer locked.

If this doesn't make sense let me know and I'll provide more detail.

Private Sub Command6_Click()
On Error GoTo Err_Command6_Click

Me![Locked] = True

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.RunCommand acCmdDataEntry
Exit_Command6_Click:
    Exit Sub

Err_Command6_Click:
    MsgBox Err.Description
    Resume Exit_Command6_Click

End Sub

Private Sub Form_Current()

If IsNull(Me![Locked]) Then Me![Locked] = 0
Me.AllowEdits = Not Me![Locked]

End Sub

Private Sub form_open(Cancel As Integer)
    If Me.RecordsetClone.RecordCount = 0 Then
        DoCmd.OpenForm "Form3"
        Cancel = True
    End If
End Sub

Thanks,

whitesandsbeach
ASKER CERTIFIED SOLUTION
Avatar of Arji
Arji
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial