Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Criteria Error (Access 2003 / 200)

    In an application I changed the Order# field in the back end data table from integer to text and now after opening a form and executing the following code I get a "data type mismatch in Criteria expression" error.

    DoCmd.OpenReport strDocName, acPreview, _
    WhereCondition:="[Order#]=" & Me.[Order#]

    I commented out the Where Condition and the error goes away, but I don't understand why I'm getting this error. Obviously, Access seems to think that Order# and Me.Order# are different types.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Criteria Error (Access 2003 / 200)

    Text values must be surrounded by quotes. Try this:

    DoCmd.OpenReport strDocName, acPreview, _
    WhereCondition:="[Order#]=" & Chr(34) & Me.[Order#] & Chr(34)

    Chr(34) is the double quote " character.

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Criteria Error (Access 2003 / 200)

    Thanks again, that fixed it.

Posting Permissions

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