OTWarrior
02-08-2008, 02:39 AM
I am trying to update the value of a record in a table with a value from another record in the same table (in this case, the end date minus one day). The code doesn't always need to be run, as there are times when openargs are not used to open this form.
The problem I am having is getting the code to update the information in the record. I put a watch on the "If (tb.Fields(0) = OpenArgs) Then
" line for when the value matches my test data, and sure enough it stops when it hits that value. unfortunately, it doesn't move onto the next line, only onto the final "end if" statement, and I am unsure why.
If OpenArgs = vbNull Then
Else
Dim tb As DAO.Recordset
Set tb = CurrentDb.OpenRecordset("tbl_bookings", dbOpenDynaset)
tb.MoveFirst
Do While Not tb.EOF
If (tb.Fields(0) = OpenArgs) Then
tb.Edit
tb.Fields(7) = [dteStartDate] - 1 ' End Date
tb.Fields(13) = False ' UFN
tb.Update
End If
tb.MoveNext
Loop
End If
Any thoughts?
The problem I am having is getting the code to update the information in the record. I put a watch on the "If (tb.Fields(0) = OpenArgs) Then
" line for when the value matches my test data, and sure enough it stops when it hits that value. unfortunately, it doesn't move onto the next line, only onto the final "end if" statement, and I am unsure why.
If OpenArgs = vbNull Then
Else
Dim tb As DAO.Recordset
Set tb = CurrentDb.OpenRecordset("tbl_bookings", dbOpenDynaset)
tb.MoveFirst
Do While Not tb.EOF
If (tb.Fields(0) = OpenArgs) Then
tb.Edit
tb.Fields(7) = [dteStartDate] - 1 ' End Date
tb.Fields(13) = False ' UFN
tb.Update
End If
tb.MoveNext
Loop
End If
Any thoughts?