View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andy Dorph Andy Dorph is offline
external usenet poster
 
Posts: 8
Default Type Mismatch Error when running a SELECT SQL

I am getting a Type Mismatch error (Error 13) occurring when I run the
following code. The Set rs statement is what is highlighted. The query
string works when I go into Design Query and paste it in the Edit SQL window.

With the exception of P_ID, all fields in the table are text fields. P_ID
is am AutoNumber field. When I display the query in a msgBox, There are no
quotes or tics around the value stored in strRecNo (as it should be). I have
used this same template for all the other select statements I am executing
with no problems.

Is there something I am missing? Any help would be appreciated.

TIA


Dim rs As Recordset

strProjectQuery = "SELECT P_FUND, P_BORG, P_NAME, P_2120, P_2125 " & _
"FROM Projects " & _
"WHERE P_ID=" & _
strRecNo & ";"

Set rs = CurrentDb().OpenRecordset(strProjectQuery)