Results 1 to 4 of 4
  1. #1
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81

    DoCmd.OpenForm with 2 Where Conditions

    I would like to open a form using 2 where conditions. I thought I could do this using AND or OR. Right now I can open it with either of the conditions I've typed in, but if I try to do both with AND in the middle, I get a "Type mismatch" error. Any ideas?

    Code:
     DoCmd.OpenForm "Employee", , , "[Employee.LastName]='" & tempLast & "'" And "[Employee.FirstName]='" & tempFirst & "'"


  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
    Common mistake; drop the quotes on both sides of And.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81
    I knew it was something simple! Thank you!

  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
    Happy to help!
    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. Docmd.openform (date) and (text)
    By sovereign in forum Forms
    Replies: 3
    Last Post: 06-19-2015, 08:07 AM
  2. DoCmd.OpenForm; 3rd Argument = FilterName
    By Access_Novice in forum Programming
    Replies: 1
    Last Post: 02-02-2014, 11:05 PM
  3. DoCmd.OpenForm Syntax Error
    By alsoto in forum Forms
    Replies: 3
    Last Post: 02-29-2012, 01:14 PM
  4. What actually happens at docmd.openform
    By Beorn in forum Programming
    Replies: 4
    Last Post: 01-05-2011, 02:19 PM
  5. DoCmd.OpenForm Modification
    By alsoto in forum Forms
    Replies: 6
    Last Post: 05-01-2009, 07:28 AM

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