mtrussell
asked on
Loop within Select Case
I have a select Case that says (I have simplified it)
Select Case Category
Case "Criteria 1"
If IsNull(Me.Date1OP.Value) Then
Me.Date1OP.Value = Date
End If
End Select
What I need is that the code goes through the entire record set and updates the date to today's date all records where the Category is 'Criteria 1'.. how do I do this?
Select Case Category
Case "Criteria 1"
If IsNull(Me.Date1OP.Value) Then
Me.Date1OP.Value = Date
End If
End Select
What I need is that the code goes through the entire record set and updates the date to today's date all records where the Category is 'Criteria 1'.. how do I do this?
ASKER
It's close but this ignores the IF statement. If there is a date already in the field I don't want to bulk update.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
dim uSql as string
Select Case Category
Case "Criteria 1"
uSql="Update TableName set [Date1OP]=Date() where Category= 'Criteria 1'"
Case "Criteria X"
uSql="Update TableName set [Date1OP]=Date() where Category= 'Criteria X'"
End Select
'update the records
currentdb.execute usql, dbfailonerror