+ Reply to Thread
Results 1 to 10 of 10

Query result: Data type mismatch

  1. #1
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    Query result: Data type mismatch

    Hello,

    I'm getting Data type mismatch for the below query, seeking for your advises please.

    Please Login or Register  to view this content.
    Thanks in advance Gurus!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Query result: Data type mismatch

    Where do you get the error?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    Re: Query result: Data type mismatch

    I think on this part Norie

    Actually, the original code is in SQL script, I've tried substituing CLng instead of Cast due to access cannot read Cast function.

    Please Login or Register  to view this content.
    btw, Report_ID is my Primary key.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Query result: Data type mismatch

    Does that query run when you try and execute it manually in the database?

    Does the database you are querying support the functions CLng and Val?

  5. #5
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    Re: Query result: Data type mismatch

    It doesn't run coz' the query seems incorrect. Yes, access database support CLng and Val functions.

    The original code was: (It is in MySQL script)
    Please Login or Register  to view this content.
    My problem in that code is that Cast function is not supported in ms access and I've search in the internet that CLng, CInt and Val functions can substitute for Cast, but unfortunately, it still gives me an error

    for the below code
    Please Login or Register  to view this content.
    i've converted it to CLng or CInt, but still it doesn't work.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by puuts; 02-09-2015 at 01:23 PM.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Query result: Data type mismatch

    Why are you using Val and CInt?

    Have you tried just using one of them?

    Also, what happens if you don't use either of them?

  7. #7
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    Re: Query result: Data type mismatch

    still get the same error. Either I've use only Val,CLng or CInt.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Query result: Data type mismatch

    Where exactly do you get the error?

  9. #9
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    Re: Query result: Data type mismatch

    It jumps on my Errohandler when entering on this line:

    Please Login or Register  to view this content.
    My whole code is:
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    Re: Query result: Data type mismatch

    I've fix it now. I've used CStr() function instead of CLng,Val or CInt since varchar is used in the original script.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Type Mismatch when exporting query to Excel
    By Frankie_The_Flyer in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2013, 07:53 PM
  2. Type mismatch in macro query
    By ill_comms in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2011, 02:35 AM
  3. Type Mismatch when running query on SQL Database
    By Neily in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2005, 11:05 AM
  4. [SOLVED] Database Query -- Data Type Mismatch
    By StephenP in forum Excel General
    Replies: 0
    Last Post: 04-14-2005, 03:06 PM
  5. [SOLVED] MS Query of Excel Datalist -- Data type mismatch
    By StephenP in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2005, 02:06 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1