I have a form that is designed work with data submitted by other users. This form is designed to update or delete data. Almost everything is working properly except I am running into a record locking problem. the code used to open the record set is as follows:
Set rst = dbHelpdesk.OpenRecordset("Helpdesk", dbOpenDynaset, dbSeeChanges, dbOptimistic)
no changes are made to the recordset until a command button is pressed. the following code then executes:
Private Sub cmdUpdate_Click()
If Not (cmbStatus.Value = "Resolved") Then
With rst
'Updates current record with changes
.Edit
![Computer Name] = Me!txtComputerName
![Building Number] = Me!txtBldgNumber
![Room Number] = Me!txtRmNumber
![Date Problem Started] = Me!txtDate
![Type of Issue] = Me!cmbType
![Remarks] = Me!txtDetailRemarks
![Rank] = Me!txtRank
![Phone Number DSN] = Me!txtPhone
![WorkLog] = Me!txtWorklog.Value
![Status] = Me!cmbStatus.Value
.Update
FrmChg = 13
End With
Else
With rstClosed
'Updates closed table with current record changes
.AddNew
![Computer Name] = Me!txtComputerName
![Building Number] = Me!txtBldgNumber
![Room Number] = Me!txtRmNumber
![Date Problem Started] = Me!txtDate
![Type of Issue] = Me!cmbType
![Remarks] = Me!txtDetailRemarks
![Rank] = Me!txtRank
![Phone Number DSN] = Me!txtPhone
![WorkLog] = txtWorklog.Value
![Status] = cmbStatus.Value
![Ticket Number] = rst![Ticket Number]
.Update
.Close
FrmChg = 12
End With
txtName.Value = Nothing
txtRank.Value = Nothing
txtUsername.Value = Nothing
txtPhone.Value = Nothing
txtUserID.Value = Nothing
txtComputerName.Value = Nothing
txtBldgNumber.Value = Nothing
txtRmNumber.Value = Nothing
txtDate.Value = Nothing
cmbType.Value = Nothing
cmbStatus.Value = "Resolved"
txtDetailRemarks.Value = Nothing
txtWorklog.Value = Nothing
Me!sbfrmWorklog!txtWorklog.Value = Nothing
With rst
.Delete
.Close
End With
End If
Me.lstTickets.Requery
End Sub
The first .edit method (highlighted red) is where my problem comes in. as far as I know the recordset should open in dbOptimistic, meaning that the record should not be locked until the .update method? any who, if I try to make a change to more than 1 field in the recordset at the same time I get a run time error because the record is locked by "another user" when there is no other user. I need to allow 2 or more changes at once, or to disable record locking completely on this recordset. is this possible? also, I just want to point out that there is no possible way that the two users using this form would hit the command button to update the same record at the same time. so record locking is not needed.
Any ideas?
Thanks,
Set rst = dbHelpdesk.OpenRecordset("Helpdesk", dbOpenDynaset, dbSeeChanges, dbOptimistic)
no changes are made to the recordset until a command button is pressed. the following code then executes:
Private Sub cmdUpdate_Click()
If Not (cmbStatus.Value = "Resolved") Then
With rst
'Updates current record with changes
.Edit
![Computer Name] = Me!txtComputerName
![Building Number] = Me!txtBldgNumber
![Room Number] = Me!txtRmNumber
![Date Problem Started] = Me!txtDate
![Type of Issue] = Me!cmbType
![Remarks] = Me!txtDetailRemarks
![Rank] = Me!txtRank
![Phone Number DSN] = Me!txtPhone
![WorkLog] = Me!txtWorklog.Value
![Status] = Me!cmbStatus.Value
.Update
FrmChg = 13
End With
Else
With rstClosed
'Updates closed table with current record changes
.AddNew
![Computer Name] = Me!txtComputerName
![Building Number] = Me!txtBldgNumber
![Room Number] = Me!txtRmNumber
![Date Problem Started] = Me!txtDate
![Type of Issue] = Me!cmbType
![Remarks] = Me!txtDetailRemarks
![Rank] = Me!txtRank
![Phone Number DSN] = Me!txtPhone
![WorkLog] = txtWorklog.Value
![Status] = cmbStatus.Value
![Ticket Number] = rst![Ticket Number]
.Update
.Close
FrmChg = 12
End With
txtName.Value = Nothing
txtRank.Value = Nothing
txtUsername.Value = Nothing
txtPhone.Value = Nothing
txtUserID.Value = Nothing
txtComputerName.Value = Nothing
txtBldgNumber.Value = Nothing
txtRmNumber.Value = Nothing
txtDate.Value = Nothing
cmbType.Value = Nothing
cmbStatus.Value = "Resolved"
txtDetailRemarks.Value = Nothing
txtWorklog.Value = Nothing
Me!sbfrmWorklog!txtWorklog.Value = Nothing
With rst
.Delete
.Close
End With
End If
Me.lstTickets.Requery
End Sub
The first .edit method (highlighted red) is where my problem comes in. as far as I know the recordset should open in dbOptimistic, meaning that the record should not be locked until the .update method? any who, if I try to make a change to more than 1 field in the recordset at the same time I get a run time error because the record is locked by "another user" when there is no other user. I need to allow 2 or more changes at once, or to disable record locking completely on this recordset. is this possible? also, I just want to point out that there is no possible way that the two users using this form would hit the command button to update the same record at the same time. so record locking is not needed.
Any ideas?
Thanks,