I am working with varying degrees of luck and satisfaction on Access 97. On one form I select a vehicle (Shop) to place in service. Once In Service I want to note when it was placed in Service and by whom. I can get it to assign the times and date, but on returning to the form and attempting to choose another vehicle it tells me that I have a write conflict with another user, (I am the only one), and then gives me an error message Run Time 2105, saying that I may be at the end of a file.
Anyone have any suggestions or advice? Attached is the code for anyone that has the chance to look over it.
Private Sub cmdPlaceShopInService_Click()
Dim answerAssgnShop As Variant
Dim answerAssgnEquip As Variant
Dim strShop As String
Dim strDesig As String
Dim strUser As String
Dim db As Database
Dim recShop As Recordset
Dim strSQL As String
If Me.txtShop = 0 Then
answerAssgnShop = MsgBox("Choose a Shop From the Available List", vbOKOnly, "No Shop Chosen")
Me.listAvailShops.SetFocus
Exit Sub
ElseIf IsNull(Me.txtUnit) Then
answerAssgnShop = MsgBox("Shop Must Be Assigned A Unit Designator", vbOKOnly, "No Unit Designator Assigned")
Me.txtUnit.SetFocus
Exit Sub
End If
Me.txtAvailability = "In Service"
strShop = Me.txtShop
strDesig = Me.txtUnit
'strUser = Me.txtUser
'MsgBox ("Current User is " & Me.txtUser)
strSQL = "SELECT * FROM tblShopInfo Where Shop = " & strShop
Set db = CurrentDb()
Set recShop = db.OpenRecordset(strSQL, dbOpenDynaset)
Do While Not recShop.EOF
recShop.Edit
recShop("ISDate") = Now
recShop("ISTime") = Now
'recShop("ISBy") = strUser
recShop.Update
recShop.MoveNext
Loop
answerAssgnShop = MsgBox("Shop " & strShop & " Has Been Placed In Service As " & strDesig, vbOKOnly, "Shop Placed In Service")
answerAssgnShop = MsgBox("Do You Wish To Assign Equipment At This Time?", vbYesNo, "Assign Equipment To Shop")
If answerAssgnShop = vbYes Then
MsgBox ("You Answered Yes")
Exit Sub
Else
Me.listAvailShops.Requery
Me.listAvailShops.SetFocus
End If
End Sub
Anyone have any suggestions or advice? Attached is the code for anyone that has the chance to look over it.
Private Sub cmdPlaceShopInService_Click()
Dim answerAssgnShop As Variant
Dim answerAssgnEquip As Variant
Dim strShop As String
Dim strDesig As String
Dim strUser As String
Dim db As Database
Dim recShop As Recordset
Dim strSQL As String
If Me.txtShop = 0 Then
answerAssgnShop = MsgBox("Choose a Shop From the Available List", vbOKOnly, "No Shop Chosen")
Me.listAvailShops.SetFocus
Exit Sub
ElseIf IsNull(Me.txtUnit) Then
answerAssgnShop = MsgBox("Shop Must Be Assigned A Unit Designator", vbOKOnly, "No Unit Designator Assigned")
Me.txtUnit.SetFocus
Exit Sub
End If
Me.txtAvailability = "In Service"
strShop = Me.txtShop
strDesig = Me.txtUnit
'strUser = Me.txtUser
'MsgBox ("Current User is " & Me.txtUser)
strSQL = "SELECT * FROM tblShopInfo Where Shop = " & strShop
Set db = CurrentDb()
Set recShop = db.OpenRecordset(strSQL, dbOpenDynaset)
Do While Not recShop.EOF
recShop.Edit
recShop("ISDate") = Now
recShop("ISTime") = Now
'recShop("ISBy") = strUser
recShop.Update
recShop.MoveNext
Loop
answerAssgnShop = MsgBox("Shop " & strShop & " Has Been Placed In Service As " & strDesig, vbOKOnly, "Shop Placed In Service")
answerAssgnShop = MsgBox("Do You Wish To Assign Equipment At This Time?", vbYesNo, "Assign Equipment To Shop")
If answerAssgnShop = vbYes Then
MsgBox ("You Answered Yes")
Exit Sub
Else
Me.listAvailShops.Requery
Me.listAvailShops.SetFocus
End If
End Sub