Results 1 to 2 of 2
  1. #1
    dunc723 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    28

    Data Type Mismatch in Query

    I have two functions Function1 and Function2 that basically do the same thing: select a group of records from a table based on two fields, analyze them to see if as a group they meet a certain standard, and return the result as a string, basically "Yes" or "". The two functions analyze the data differently - I discovered a case where Function1 could return an incorrect result under certain conditions, so I refined the logic and wrote Function2. So far so good.



    I have a summary query Query1 from the same table; it groups on one field ([TripID]), finds the min and max of dates corresponding to that TripID, totals the Miles for the TripID, and calls the two functions noted above, such that Field1 = Function1([TripID]) and Field2 = Function2([TripID]). The values in Field1 and Field2 are "" or "" as noted above. Still so far so good - results are as expected.

    Next I have another query Query2 based on the Query1 that selects only the records where Field1 = "Yes". That works perfectly. But when I instead try to select the records where Field2 = "Yes", I get Data Type Mismatch in Criteria Expression. If I eliminate the criteria, Query2 runs fine (it looks just like Query1).

    So I'm baffled why one works and one does not. I cannot find any differences in data type, and I have tried changing field names and string results to avoid anything that might be confusing.

    Any suggestions?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Would have to analyze data and code. If you want to provide, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 05-17-2013, 04:00 PM
  2. Replies: 2
    Last Post: 03-19-2013, 09:36 PM
  3. Data type mismatch in query criteria
    By TinaCa in forum Queries
    Replies: 2
    Last Post: 09-19-2011, 11:31 PM
  4. Data Type Mismatch
    By timmy in forum Programming
    Replies: 9
    Last Post: 04-12-2011, 03:48 AM
  5. Data type mismatch in query
    By thart21 in forum Queries
    Replies: 8
    Last Post: 10-01-2010, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums