I just came back to the experts as I cannot find a solution to this problem. It should be simple but not for me.
I have a fairly simple database and my vbs code which worked in the past is locked out of this table.
I am just trying to edit two fields in the table, a date field and a distance field which is long integer.
In frustration I made a completely new database with just this one table and created the table as new and it still cannot work. I tried two different methods, as can be seen in the code and get the error which I have also shown in the code. Nothing is changed in the table.
Private Sub NewService_MouseDown(Butto
n As Integer, Shift As Integer, x As Single, Y As Single)
Dim b As Integer, d As Integer, DummyDate As Integer
Dim NewData As String, bilum As String
Dim db As Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Dim myBestShot As Date
Set rs = db.OpenRecordset("BReq")
b = 16
NewData = "Check" & CStr(b)
alue = -1 Then
bilum = "Label" & CStr(b)
DummyDate = DLookup("TimeReq", "BReq", "ReqID =" & b)
myBestShot = DateAdd("d", DummyDate, Me.DateReq)
On Error GoTo handler
CurrentDb.Execute ("UPDATE BReq SET DueDate = " & myBestShot _
& " WHERE ReqID =" & b), dbFailOnError
MsgBox Err & " " & Err.Description
' Error here is 3218 Could not update; currently locked.
rs.Fields("DueDate") = DateAdd("d", DummyDate, Me.DateReq)
rs!DueDate = DateAdd("d", DummyDate, Me.DateReq)
'processes these lines but changes nothing in the table
d = DLookup("DistanceReq", "BReq", "ReqID =" & b)
rs.Fields("DueOdom") = Me.CurrOdo + d