+ Reply to Thread
Results 1 to 2 of 2

Excel/SQL Hybrid - Run-time Error: Data type mismatch in criteria expression

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    alberta, canada
    MS-Off Ver
    Excel 2010
    Posts
    39

    Excel/SQL Hybrid - Run-time Error: Data type mismatch in criteria expression

    Hello!

    I am working on a database for entering and pulling old invoices. I am essentially using the excel document as a sql database and limiting user imput on the cells themself to avoid error as many of the people that will use it like to delete things.

    How the document works:
    The users can select fields from the Combo Boxes that will help them limit their searches. One of these limiting factors is a date range from range 1 to range 2. This is the only thing that I seem to have issues with:

    Please Login or Register  to view this content.
    To my understanding it is having trouble taking the dates entered in the cells and using it in SQL. It works just fine if you leave the date range blank, it is just when you use it as a search criteria.

    The range however is extremely important so I cannot do without.

    Let me know if you have any questions and I will do my best to answer them!
    Attached Files Attached Files
    Last edited by Sleepyshy; 03-11-2016 at 05:44 PM.

  2. #2
    Registered User
    Join Date
    11-30-2012
    Location
    alberta, canada
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Excel/SQL Hybrid - Run-time Error: Data type mismatch in criteria expression

    Hello Again,

    After having a moment of brilliance and then an hour of frustration... I have solved the issued. See attached for the fix in action:

    I changed the cell formatting to Text and made the userform spit out any date that the user enters as yyyy-mm-dd hh:MM:ss "2016-03-11 00:00:00". For some reason when you set the cell formatting to this, it actually changes it slightly to include an extra space and to have an AM/PM at the end causing the issues that I was seeing. VBA does work correctly, however Excel cell formatting does not.

    I hope that this document helps those that have experienced a similar issue. Feel free to contact me if you have any questions regarding this document.
    Attached Files Attached Files

+ 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. Run-Time Type 13 Mismatch Error help - Excel VBA
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-08-2015, 06:19 AM
  2. error 3464 data type mismatch in criteria expression in CurrentDb.Execute update
    By SKooLZ in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2015, 09:05 AM
  3. Excel VBA Run-time error '13' Type mismatch
    By svibuk in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2014, 04:23 AM
  4. Excel VBA Run-time error '13' Type mismatch
    By pankajpm in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-27-2013, 05:34 AM
  5. [SOLVED] Excel VBA Run-time error '13' Type mismatch
    By mackypogi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2013, 02:15 AM
  6. Excel VBA Run-time error '13' Type mismatch
    By edgaryp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2013, 06:48 PM
  7. [SOLVED] Data Type Mismatch in Criteria Expression
    By williams485 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-15-2012, 10:26 AM

Tags for this Thread

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