iglobalusa
Registered User.
- Local time
- Today, 09:07
- Joined
- Jul 12, 2008
- Messages
- 30
Can anyone see why this code is not updating the field?
Thanks for your help.
Code:
Private Sub txtstateno_AfterUpdate()
On Error GoTo Error_txtstateno_AfterUpdate
'look for all records with the same stateno then update the same edited field
strSQL = "Select * from labdata Where stateno = '" & Me.stateno & "'"
Set DAO_DB = CurrentDb
Set DAO_RS = DAO_DB.OpenRecordset(strSQL, dbOpenDynaset)
With DAO_RS
If Not .EOF And Not .BOF Then
Do until.EOF
'edit
.Edit
!stateno = Me.stateno
!transfer = 0
'commit the edit
.Update
'move to next record if not EOF
.MoveNext
Loop
.Close
End With
'clear recordset
Set DAO_RS = Nothing
Exit_txtstateno_AfterUpdate:
Exit Sub
Error_txtstateno_AfterUpdate:
MsgBox "Error Number: " & Err.Number & vbCrLf & "Error Description: " & _
Err.Description, vbInformation, "Error:"
Resume Exit_txtstateno_AfterUpdate
End Sub
Thanks for your help.