Hi,
I am trying to do something which should be quite simple but I can't get it to work. Basically I just written a code that scrolls through a dataset and when it finds a null field it will change it to "-1" but my code isn't working. Any help would be appreciated.
Thanks.
I am trying to do something which should be quite simple but I can't get it to work. Basically I just written a code that scrolls through a dataset and when it finds a null field it will change it to "-1" but my code isn't working. Any help would be appreciated.
Code:
Function FldTest()
Dim db As Database
Set db = CurrentDb
Dim rsMainSurvey As DAO.Recordset
Set rsMainSurvey = db.OpenRecordset("SELECT * FROM tblMainTable", dbOpenDynaset)
Dim fld As DAO.Field
rsMainSurvey.MoveFirst
Do While Not rsMainSurvey.EOF
For Each fld In rsMainSurvey.fields
If IsNull(fld) Then
With rsMainSurvey
.Edit
!fld.Value = "-1"
.Update
End With
End If
Next
rsMainSurvey.MoveNext
Loop
Debug.Print "Update Complete"
End Function
Thanks.