Greetings
I am grappling with a problem with some code I have put into On Change of a field
I set up the field with the following code;
Private Sub Location_Enter()
Dim sqltext
sqltext = "SELECT tbl_Data_Vessel_Barrel_Position.Position "
sqltext = sqltext & "FROM tbl_Data_Vessel_Barrel_Position WHERE (((tbl_Data_Vessel_Barrel_Position.InUse)=No)) "
If IsNothing(Me.Location) Then
Me.Location.InputMask = ">LL00000"
Me.Location.RowSource = sqltext
'Me.Location.LimitToList
Me.Location.Requery
End If
End Sub
This works fine as but the On Change command I use;
Private Sub Location_Change()
Dim db1 As DAO.Database
Dim rst As DAO.Recordset
Set db1 = CurrentDb
Set rst = db1.OpenRecordset("tbl_Data_Vessel_Barrel_Position")
rst.Index = "PrimaryKey"
rst.Seek "=", Me.Location
rst.Edit
rst!InUse = "0"
rst.Update
rst.Close
Set db1 = Nothing
Set rst = Nothing
End Sub
Must assume that the field has been changed is some way.
Can anyone spot or suggest how to rectify this problem.
Thanks
~rbinder
I am grappling with a problem with some code I have put into On Change of a field
I set up the field with the following code;
Private Sub Location_Enter()
Dim sqltext
sqltext = "SELECT tbl_Data_Vessel_Barrel_Position.Position "
sqltext = sqltext & "FROM tbl_Data_Vessel_Barrel_Position WHERE (((tbl_Data_Vessel_Barrel_Position.InUse)=No)) "
If IsNothing(Me.Location) Then
Me.Location.InputMask = ">LL00000"
Me.Location.RowSource = sqltext
'Me.Location.LimitToList
Me.Location.Requery
End If
End Sub
This works fine as but the On Change command I use;
Private Sub Location_Change()
Dim db1 As DAO.Database
Dim rst As DAO.Recordset
Set db1 = CurrentDb
Set rst = db1.OpenRecordset("tbl_Data_Vessel_Barrel_Position")
rst.Index = "PrimaryKey"
rst.Seek "=", Me.Location
rst.Edit
rst!InUse = "0"
rst.Update
rst.Close
Set db1 = Nothing
Set rst = Nothing
End Sub
Must assume that the field has been changed is some way.
Can anyone spot or suggest how to rectify this problem.
Thanks
~rbinder