Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Data Type Mismatched (Access 2002)

    I have a form that has a command button that will open a Report in Preview; I want the Report to only Select certain records. Thus I used stLinkCriteria = "[GrpID]=" & "'" & Me![GrpID] & "'" in the VB Code when executing "DoCmd.OpenReport". However when I use the command button I get a "Data Type Mismatch In Criteria Expression" error. GrpID is a auto number.

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Data Type Mismatched (Access 2002)

    You don't need the single quotes that surround GrpID, change it to:

    stLinkCriteria = "[GrpID]=" & Me![GrpID]

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Type Mismatched (Access 2002)

    Thanks; that did the trick. When do you need the single quotes?

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Data Type Mismatched (Access 2002)

    When the criteria is a string, you need to add the quotes. If it's numeric (not just a string that looks like a number), then you leave the extra quotes off.
    Charlotte

Posting Permissions

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