Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Posts
    56

    Question Unanswered: Criteria Building Problem - Any ideas?

    Hi all,

    I am trying to filter a report based on teh values in two controls on a form. However I keep getting a 'datatype mismatched in expression' error message. Anyone have ideas as to why this is occuring?

    (both controls are populated by fields in one table and both act as a composite key - is there any way this could be causing the problem?)

    strDocName = "Report"
    strWhere = "[order_no]=" & Me!order_no
    strWhereDate = " AND [date_order]=" & "'" & Me!date_order & "'"
    strWhereAll = strWhere + strWhereDate
    DoCmd.OpenReport strDocName, acPreview, , strWhereAll

    any help would be greatly appreciated!

    C.

  2. #2
    Join Date
    Feb 2004
    Posts
    142
    In Access to set a date reference use "#" around the date instead of "'" and it should work. Using the ' makes the reference a string not a date which leads to a datatype mismatch.
    KC

  3. #3
    Join Date
    Jan 2003
    Posts
    56
    Originally posted by AZ KC
    In Access to set a date reference use "#" around the date instead of "'" and it should work. Using the ' makes the reference a string not a date which leads to a datatype mismatch.

    DoH! Thanks a million. It works fine now.

Posting Permissions

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