Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Andy,
If you declare your Recordset variable like this: Dim rs As DAO.Recordset Does that solve your problem? If so you most likely have the Microsoft ActiveX Data Objects type library referenced in your project. -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm "Andy Dorph" wrote in message ... 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) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Type mismatch error | Excel Programming | |||
Why type mismatch - R/T error 13 | Excel Discussion (Misc queries) | |||
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error | Excel Programming | |||
Type mismatch while running If statement | Excel Programming |