Can someone explain why this is evaluating as having no records when I actually print the strSQL and run it, it produces several records.
The problem is with the WHERE Clause, if I change it to this:
It works as intended... But I was having a serious issue with using double quotes and such. Since using this laptop I haven't been able to use the ASCII to get double quotes, like I have always done (e.g., & Chr(34) &, ends up yeilding two sets of double quotes in the string... seems that single quotes are the only way I can do this now...
Also doing something like:
Ends up evaluating as:
WHERE NSN_TYPE Like ""*"P"*"""
Or some such craziness... I have been dealing with SQL strings for well over a decade and all of a sudden I am having issues with this... what is going on?
Why won't the original where clause evaluate as something cool... instead of something Uber lame?
V/R,
-Gary
strSQL = "SELECT STOREROOM, NSN, [NCF LIFE EXP], SumOfQTY, REGISTERED, STATUS_TYPE, " & _
"NSN_TYPE, Found_In, OA, BP_Position " & _
"FROM 10_POINVASS " & _
"WHERE NSN_TYPE Like '*P*' " & _
"AND STATUS_TYPE = 'FNOO' " & _
"AND STOREROOM = '" & strSTOREROOM & "' " & _
"ORDER BY NSN, OA ;"
With rsFROM
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open (strSQL)
End With
' MsgBox (rsFROM.RecordCount)
If rsFROM.RecordCount <> 0 Then
'something cool
Else
'Uber lame
End If
The problem is with the WHERE Clause, if I change it to this:
"WHERE Instr(NSN_TYPE, 'P') > 0 " & _
It works as intended... But I was having a serious issue with using double quotes and such. Since using this laptop I haven't been able to use the ASCII to get double quotes, like I have always done (e.g., & Chr(34) &, ends up yeilding two sets of double quotes in the string... seems that single quotes are the only way I can do this now...
Also doing something like:
"WHERE NSN_TYPE Like " & chr(34) & Chr(42) & "P" & Chr(42) & Chr(34) & " " & _
Ends up evaluating as:
WHERE NSN_TYPE Like ""*"P"*"""
Or some such craziness... I have been dealing with SQL strings for well over a decade and all of a sudden I am having issues with this... what is going on?
Why won't the original where clause evaluate as something cool... instead of something Uber lame?
V/R,
-Gary