Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004

    Unanswered: Data type mismatch on openrecordset?!

    Hey guys, trying to figure out a weird error I'm getting in access 2000. Here's the code block:

    sql = "SELECT [dbo_Application].[User_Login], [dbo_Application].[Term], [dbo_Login_Accounts].[First_Name], [dbo_Login_Accounts].[Last_Name], [dbo_Login_Accounts].[Email_Address], [dbo_Login_Accounts].[H_Phone], [dbo_Login_Accounts].[W_Phone], [dbo_Applicant_Address].[City], [dbo_Applicant_Address].[Country]" & _
    "FROM (dbo_CorrespondenceTypes INNER JOIN (((dbo_App_Status INNER JOIN dbo_Application_History ON [dbo_App_Status].[Application_Number]=[dbo_Application_History].[Application_Number]) INNER JOIN dbo_Application ON [dbo_App_Status].[User_Login]=[dbo_Application].[User_Login]) INNER JOIN dbo_Login_Accounts ON [dbo_App_Status].[User_Login]=[dbo_Login_Accounts].[User_Login]) ON [dbo_CorrespondenceTypes].[Letter_ID]=[dbo_Application_History].[Status_Code]) INNER JOIN dbo_Applicant_Address ON [dbo_Application].[User_Login]=[dbo_Applicant_Address].[User_Login] " & _
    "WHERE ((([dbo_Application].[Term]) Like '" & [Forms]![frmMain]![drpTerm] & "*') And (([dbo_Application_History].[Status_Date]) Between # " & [Forms]![frmMain]![txtStartDate] & "# And #" & [Forms]![frmMain]![txtEndDate] & "#) And (([dbo_CorrespondenceTypes].[Batch_Group]) In (""COMM"",""ADMT"",""DFRQ"") And ([dbo_CorrespondenceTypes].[Batch_Group])=""admt"") And (([dbo_Applicant_Address].[Address_Type])=""r"") And (([dbo_Application].[Program])=""mba""))"
    InputBox "test", "test", sql
    Set rs = db.OpenRecordset(sql)
    MsgBox "running"

    It dies on the "set rs" line. I get a runtime error 13 type mismatch. Any ideas why? When the inputbox comes up I can copy the SQL and run it no problem.

  2. #2
    Join Date
    Oct 2003
    It is probably doing a wierd conversion on you. I would verify the types of data in all of the [Forms]![...]![...] arguments you are supplying.

    For example, what is [Forms]![frmMain]![drpTerm]? If it is a number, then you may need to use cstr([Forms]![frmMain]![drpTerm])

  3. #3
    Join Date
    Jan 2004
    Grrrr, it actually turned out that I needed to declare rs as a DAO.recordset rather than just PLAIN recordset. I'm used to using access 97 so some of this is new to me... Thanks for your help tho!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts