Results 1 to 6 of 6
  1. #1
    Gath is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2015
    Posts
    3

    Data Type Mismatch in Criteria Expression


    Hi, I have a field where numbers are stored as text. I created another field where I converted text to numbers using the Val function. However, when I try to perform math functions on this new field (e.g. greater than, equal to, etc.), I get this message "Data Type Mismatch in Criteria Expression". Why?

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Can you post the SQL code of your query?

  3. #3
    Gath is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2015
    Posts
    3
    Sure, it's"

    SELECT WellConstrSummary.[Location Desc], WellConstrSummary.[Location ID], [Well-SampleID_CrossWalk].[QA/QC], UnionAll_LDC.ANALYTE, UnionAll_LDC.ANALYTE_VALUE, UnionAll_LDC.FINAL_QUALIFIER, Val([ANALYTE_VALUE]) AS Expr1
    FROM ((UnionAll_LDC INNER JOIN [Well-SampleID_CrossWalk] ON UnionAll_LDC.SAMPLE_NAME = [Well-SampleID_CrossWalk].SampleID) INNER JOIN [AnalyteMethod-Group_CrossWalk] ON UnionAll_LDC.ANALYTICAL_METHOD = [AnalyteMethod-Group_CrossWalk].ANALYTICAL_METHOD) INNER JOIN WellConstrSummary ON [Well-SampleID_CrossWalk].[Well ID] = WellConstrSummary.[Well ID]
    WHERE (((WellConstrSummary.[Location Desc]) Like "*First Sand*") AND (([Well-SampleID_CrossWalk].[QA/QC])="Duplicate" Or ([Well-SampleID_CrossWalk].[QA/QC])="ms/msd" Or ([Well-SampleID_CrossWalk].[QA/QC]) Is Null) AND ((UnionAll_LDC.ANALYTE)="vinyl chloride") AND ((Val([ANALYTE_VALUE]))>5) AND ((UnionAll_LDC.REPORTABLE_RESULT)="y"));

  4. #4
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Did you create the field in a table or in a query?

    If it is in a table, what's the data type of the new field? Text or Number???

    If it is in a query, can you post the SQL?

  5. #5
    Gath is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2015
    Posts
    3
    I created the field in a query. How should I post the SQL? You mean the SQL code posted above?

  6. #6
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Yes, timing is everything.

    I don't have the structure to test. But this might be your problem.


    SELECT WellConstrSummary.[Location Desc], WellConstrSummary.[Location ID], [Well-SampleID_CrossWalk].[QA/QC], UnionAll_LDC.ANALYTE, UnionAll_LDC.ANALYTE_VALUE, UnionAll_LDC.FINAL_QUALIFIER, Val(UnionAll_LDC.ANALYTE_VALUE) AS Expr1
    FROM ((UnionAll_LDC INNER JOIN [Well-SampleID_CrossWalk] ON UnionAll_LDC.SAMPLE_NAME = [Well-SampleID_CrossWalk].SampleID) INNER JOIN [AnalyteMethod-Group_CrossWalk] ON UnionAll_LDC.ANALYTICAL_METHOD = [AnalyteMethod-Group_CrossWalk].ANALYTICAL_METHOD) INNER JOIN WellConstrSummary ON [Well-SampleID_CrossWalk].[Well ID] = WellConstrSummary.[Well ID]
    WHERE (((WellConstrSummary.[Location Desc]) Like "*First Sand*") AND (([Well-SampleID_CrossWalk].[QA/QC])="Duplicate" Or ([Well-SampleID_CrossWalk].[QA/QC])="ms/msd" Or ([Well-SampleID_CrossWalk].[QA/QC]) Is Null) AND ((UnionAll_LDC.ANALYTE)="vinyl chloride") AND ((Val(UnionAll_LDC.ANALYTE_VALUE)))>5) AND ((UnionAll_LDC.REPORTABLE_RESULT)="y"));

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

Similar Threads

  1. Data type mismatch in criteria expression
    By khughes46 in forum Queries
    Replies: 12
    Last Post: 05-01-2014, 07:34 AM
  2. Data type mismatch in criteria expression
    By bobt_1234 in forum Queries
    Replies: 3
    Last Post: 02-13-2012, 03:37 PM
  3. Data type mismatch in criteria expression
    By buienxg in forum Access
    Replies: 2
    Last Post: 11-22-2011, 10:29 AM
  4. Data type mismatch in criteria expression
    By Douglasrac in forum Forms
    Replies: 3
    Last Post: 11-23-2010, 10:46 AM
  5. data type mismatch in criteria expression
    By broecher in forum Access
    Replies: 4
    Last Post: 09-10-2010, 08:29 AM

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