Results 1 to 8 of 8
  1. #1
    trident is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    141

    Retrieve a data by using query

    I have created a table that tracks a document with the following fields:

    ID - Automatic
    InvNo - Invoice No - accepts same number
    TrckDat - Track Date
    Remarks

    I created a query, wherein I want to enter the INVNo and the Track Date for these invoice will only appear.

    I have placed in the criteria:

    Enter [InvNo]

    The error is "DATA TYPE MISMATCH"



    can you please help me.

    Thank you.

    Trident

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Data mismatch says you are trying to enter a string into a number field.
    in the table, did you set the INVNO as string or #?
    do you have a query doing the same?

  3. #3
    trident is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    141
    The INVNO is set as Number.

    when I tried the BETWEEN [] AND [], it was able to retrieve the the correct information.

    however, I only need to check a number at a time.

    Even in the old MS Access, I tried the same and it is the same error.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    ???
    Even in the old MS Access, I tried the same and it is the same error.
    Please post the SQL of the query you are trying to execute.

  5. #5
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    my guess the criteria for the sql will be

    WHERE (INVNO="Enter [InvNo]")

  6. #6
    trident is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    141
    Click image for larger version. 

Name:	msaccess query.jpg 
Views:	9 
Size:	130.9 KB 
ID:	23541
    Above is the query I was working at with the error included.

    What am I doing wrong. Previously, in the criteria, Just enter the word "ENTER [FIELD]" will give the desired result.

  7. #7
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    you need to put square brackets round the whole thing (and preferably not use square brackets in your 'name') e.g.

    [ENTER (InvNo)]

  8. #8
    trident is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    141
    Thank you Ajax

    It works.

    Trident

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

Similar Threads

  1. using SQL in VBA to retrieve data
    By sovereign in forum Access
    Replies: 8
    Last Post: 08-25-2015, 10:17 AM
  2. Replies: 1
    Last Post: 03-17-2014, 12:26 PM
  3. Replies: 5
    Last Post: 02-21-2013, 02:34 PM
  4. Retrieve Data Too Slow
    By BGF in forum Programming
    Replies: 8
    Last Post: 09-08-2010, 04:28 PM
  5. Unable to retrieve data on Comboboxes
    By ditogui in forum Forms
    Replies: 8
    Last Post: 12-29-2009, 10:26 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