hello,
i have a problem using access 2003 and SQLServer. using DOBC. If i'm using the mdb by myself then it's working fine. However, this is a shared mdb by network, so more than 2 people can open the database at the same time. All other forms are working except 1 form after i hit a button then another user can not open the database and got the message "the database has been placed in a state by user "Admin" on machine "ADDD" that prevents it from being opened or locked"...Please help
Code below after hit the button:
Private Sub cmdAdd_Click()
Dim rst As Recordset
Dim wsp As Workspace
Dim ID As Integer
On Error GoTo Err_cmdAdd_Click
DoCmd.Hourglass True
Me.Refresh
Set wsp = DBEngine.Workspaces(0)
wsp.BeginTrans
Set rst = CurrentDb.OpenRecordset("TableA")
ID = 1
With rst
For ID = 1 To 10
.AddNew
![ID_NO] = Me.txtID_NO
![TDC] = ID
![OptSelect] = "2"
.Update
Next ID
.Close
End With
Set rst = Nothing
wsp.CommitTrans
Me.Refresh
Me.TabCtlDetail.Visible = True
Me.txtCode.SetFocus
Me.cmdAddViolation.Enabled = False
DoCmd.Hourglass False
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
DoCmd.Hourglass False
MsgBox Err.Description
wsp.Rollback
Resume Exit_cmdAdd_Click
End Sub
TN (USA). I'm using Windows XP, Access 2003, Crystal Reports 11 and SQL Server
i have a problem using access 2003 and SQLServer. using DOBC. If i'm using the mdb by myself then it's working fine. However, this is a shared mdb by network, so more than 2 people can open the database at the same time. All other forms are working except 1 form after i hit a button then another user can not open the database and got the message "the database has been placed in a state by user "Admin" on machine "ADDD" that prevents it from being opened or locked"...Please help
Code below after hit the button:
Private Sub cmdAdd_Click()
Dim rst As Recordset
Dim wsp As Workspace
Dim ID As Integer
On Error GoTo Err_cmdAdd_Click
DoCmd.Hourglass True
Me.Refresh
Set wsp = DBEngine.Workspaces(0)
wsp.BeginTrans
Set rst = CurrentDb.OpenRecordset("TableA")
ID = 1
With rst
For ID = 1 To 10
.AddNew
![ID_NO] = Me.txtID_NO
![TDC] = ID
![OptSelect] = "2"
.Update
Next ID
.Close
End With
Set rst = Nothing
wsp.CommitTrans
Me.Refresh
Me.TabCtlDetail.Visible = True
Me.txtCode.SetFocus
Me.cmdAddViolation.Enabled = False
DoCmd.Hourglass False
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
DoCmd.Hourglass False
MsgBox Err.Description
wsp.Rollback
Resume Exit_cmdAdd_Click
End Sub
TN (USA). I'm using Windows XP, Access 2003, Crystal Reports 11 and SQL Server