D
DeDBlanK
Green VBA user here. I know there is a lot of the 'Operation not
found' issues out there and I have tried several solutions to get this
simple key check to work to no avail.
Here's the code:
txtVendNumb = "US" & strVendNumb
Set Db = CurrentDb()
strSQL = "SELECT count(*) FROM tblVendor WHERE " &
strVendorQAD & " = " & txtVendNumb
'MsgBox to see the SQL statement
MsgBox strSQL
Set Rs = CurrentDb.OpenRecordset(strSQL)
If Rs.RecordCount > 0 Then ...
txtVendNumb is text and so is strVendorQAD
when I run the code the strSQL is giving me this in the MsgBox
SELECT count(*) FROM tblVendor WHERE = US1234 (the 1234 is what was
enter from the prompt) and it throws the Run-Time Error of 3075
(Missing operator).
I also tried the ... WHERE '" & strVendorQAD & '" = " &
txtVendNumb for the strSQL and the same issue is showing in the
MsgBox of no strVendorQAD in the SQL, however, it does complete the
COUNT but with incorrect results. It comes back stating (no matter
what's entered it has a result of 1 in the Rs.RecordCount because of
matching nothing I presume).
Any help would be greatly appreciated.
found' issues out there and I have tried several solutions to get this
simple key check to work to no avail.
Here's the code:
txtVendNumb = "US" & strVendNumb
Set Db = CurrentDb()
strSQL = "SELECT count(*) FROM tblVendor WHERE " &
strVendorQAD & " = " & txtVendNumb
'MsgBox to see the SQL statement
MsgBox strSQL
Set Rs = CurrentDb.OpenRecordset(strSQL)
If Rs.RecordCount > 0 Then ...
txtVendNumb is text and so is strVendorQAD
when I run the code the strSQL is giving me this in the MsgBox
SELECT count(*) FROM tblVendor WHERE = US1234 (the 1234 is what was
enter from the prompt) and it throws the Run-Time Error of 3075
(Missing operator).
I also tried the ... WHERE '" & strVendorQAD & '" = " &
txtVendNumb for the strSQL and the same issue is showing in the
MsgBox of no strVendorQAD in the SQL, however, it does complete the
COUNT but with incorrect results. It comes back stating (no matter
what's entered it has a result of 1 in the Rs.RecordCount because of
matching nothing I presume).
Any help would be greatly appreciated.