Results 1 to 7 of 7
  1. #1
    kableland777 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Florida
    Posts
    3

    Multiple Where Condition

    Here is my single Where Condition: ="[RAILCAR#] = '" & [RAILCAR#] & "'"
    I've placed it in a macro and it works fine. I also need to add a condition where [MODEL#] = [MODEL#] on the form I am opening, how do I do that? I've tried many different variations with no luck. The button this macro is attached to is in a report and meant to open a form taking me to the exact record where both conditions are met. I'm using Access 2013.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Basically they would look the same, but joined by And. The common mistake is leaving the last set of quotes in when adding the second condition. Why don't you post your effort?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    kableland777 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Florida
    Posts
    3
    [QUOTE=pbaldy;380844]Basically they would look the same, but joined by And. The common mistake is leaving the last set of quotes in when adding the second condition. Why don't you post your effort?[I tried this and it didn't return the correct record: ="[RAILCAR#] = '" & [RAILCAR#] & "'" And "[MODEL#] = '" & [MODEL#]

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    That's the classic error I mentioned plus you didn't add the delimiter after model. Try

    ="[RAILCAR#] = '" & [RAILCAR#] & "' And [MODEL#] = '" & [MODEL#] & "'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I may not have stated the bit about the last set of quotes clearly. The classic mistake is the ones in red, which need to be deleted:

    ="[RAILCAR#] = '" & [RAILCAR#] & "'" And "[MODEL#] = '" & [MODEL#]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    kableland777 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Florida
    Posts
    3
    Thank you, I would have never thought of eliminating the outside double quote, I was deleting the inside double quote. Thank you very much!!

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 06-17-2016, 02:30 PM
  2. Replies: 4
    Last Post: 10-16-2013, 01:05 PM
  3. Replies: 6
    Last Post: 07-29-2013, 05:05 AM
  4. DLookup with multiple field condition
    By agent- in forum Programming
    Replies: 4
    Last Post: 10-15-2011, 05:17 PM
  5. Printing multiple reports at once based on condition
    By justinwright in forum Reports
    Replies: 24
    Last Post: 04-13-2011, 01:40 PM

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