Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Sep 2004
    Location
    Sacramento, California, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Type Mismatch (Access XP WinXPPro)

    The following code is used to evaluate selections from an option group on a form and based on the selections made opens a report. All cases work except Case 9. As soon as I add the OR condition I get a type mismatch. The field Current Status is a text field. Case 9 is designed to exclude Exempt and Withdrawn entries. It works fine with
    stLinkCriteria = "[Current Status] <>" & """Withdrawn""" to eliminate Withdrawn, and it works fine with
    stLinkCriteria = "[Current Status] <> " & """Exempt""" to eliminate Exempt. Just get the error when I use the Or condition.



    Select Case Me!Options
    Case 1
    stLinkCriteria = "[Current Status] =" & """Approved"""
    Case 2
    stLinkCriteria = "[Current Status] =" & """Approved with Comments"""
    Case 3
    stLinkCriteria = "[Current Status] =" & """Denied"""
    Case 4
    stLinkCriteria = "[Current Status] =" & """Exempt"""
    Case 5
    stLinkCriteria = "[Current Status] =" & """Review Pending"""
    Case 6
    stLinkCriteria = "[Current Status] =" & """Revised"""
    Case 7
    stLinkCriteria = "[Current Status] =" & """Withdrawn"""
    Case 9
    stLinkCriteria = "[Current Status] <>" & """Withdrawn""" Or "[Current Status] <>" & """Exempt"""
    Case Else
    stLinkCriteria = ""
    End Select

    stDocName = "ByFacilityReviewer-rptStat"
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

    End If

    Any ideas or suggestions would be greatly appreciated.
    Carla

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

    Re: Type Mismatch (Access XP WinXPPro)

    You placed the Or outside the quotes. Use this:

    <code>stLinkCriteria = "[Current Status] <> ""Withdrawn"" Or [Current Status] <> ""Exempt"""</code>

    (I eliminated the superfluous &s)

  3. #3
    4 Star Lounger
    Join Date
    Sep 2004
    Location
    Sacramento, California, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Type Mismatch (Access XP WinXPPro)

    Hi Hans,

    The line you sent does not return a type mismatch, but it also returns the entire set of records.
    stLinkCriteria = "[Current Status] <> ""Withdrawn""" This line will eliminate Withdrawn
    stLinkCriteria = "[Current Status] <> ""Exempt""" This line will eliminate Exempt
    Any other ideas?

    Thank you again for your help
    Carla

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

    Re: Type Mismatch (Access XP WinXPPro)

    Does replacing Or with And do what you want?

  5. #5
    4 Star Lounger
    Join Date
    Sep 2004
    Location
    Sacramento, California, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Type Mismatch (Access XP WinXPPro)

    Ok, I have found the problem. Current Status is a field that comes from a subquery. Not only did I have a quote problem, I also needed an AND condition. Thank you so much for restarting my thinking. I have spent way too much time on apparently being brain dead today.
    Carla

Posting Permissions

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