I'm trying to get figure out a work around for this coding.
Essentially this code checks the values of fields in Table CFRRR if program and language match the values in table attendance Programs and Language.
This normal code works. However, if there is not a matching value for language then the code continues to just loop.
I want to adjust the code to go to the next strSQL if there is no matching language, but I can't get it to run through the next strSQL.
I think my error is that I am not writing the IF/THEN statement correctly. Here's the code:
a = Program
b = language
strSQL = "SELECT TOP 1 userID FROM attendance where attendance.Programs LIKE '*" & a & "*' AND attendance.Language LIKE '*" & b & "*' AND Status = 'Available' AND attendance.Tracking = 0"
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
If strSQL = Null Then
strSQL = "SELECT TOP 1 userID FROM attendance where attendance.Programs LIKE '*" & a & "*' AND Status = 'Available' AND attendance.Tracking = 0"
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
End IF
Thank you :)
rseither contains records or not. So you'll need to check if afterSet rs = .... But, and this is probably one of the reasons Bohemian put this on hold, I can't see any loop that you describe. I can't follow your logic, but I can say that theif strSQL = nullis not correct.set rs = ...would something like this:If rs!UserID = Null Thenwork? Because if the UserID is not set to a value I know there wasn't a language that matched.