Hi
Attempting to adapt some VBA in order to sequentially number a field (named Code) based upon whether another field (txtimagename) is either blank or Is Null.
Code I have to date for a button on my form:
This code works on the table but currently will number the 'Code' field irrespective of whether txtimagename is null/empty or not. Have tinkered with a 'where clause' but struggling with the syntax - any pointers/assistance would be greatly appreciated
Attempting to adapt some VBA in order to sequentially number a field (named Code) based upon whether another field (txtimagename) is either blank or Is Null.
Code I have to date for a button on my form:
Code:
Dim dbc As Database
Dim rst As Recordset
Dim i As Long
i = 1
Set dbc = CurrentDb()
Set rst = dbc.OpenRecordset("select * from TBL_SurveyDetail ORDER BY TBL_SurveyDetail.SurveyDetailMainFormLinkNumber, TBL_SurveyDetail.DistanceM, TBL_SurveyDetail.txtimagename;")
Do While Not rst.EOF
rst.Edit
rst!Code = i
rst.Update
rst.MoveNext
i = i + 1
Loop
rst.Close
This code works on the table but currently will number the 'Code' field irrespective of whether txtimagename is null/empty or not. Have tinkered with a 'where clause' but struggling with the syntax - any pointers/assistance would be greatly appreciated