Results 1 to 3 of 3
  1. #1
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101

    Docmd.Openform with multiple criteria WHERE condition using AND operator.Getting error

    I've been opening a split form to the first record on that form from a multi column combo box on the main form(with sub forms) that limits the records shown to those matching one of the columns in the combo box. It has been working with single criteria, but now I'd like to open it and use another piece of criteria to move to the specific record on that split form. I have attached the code and screen shot of the form.My problem is I'm getting an error and I've tried a bunch of ways (syntax) and can't seem to get it to work. Could someone have a look and maybe tell me what my "AND" where clause should look like. Thank You.


    Click image for larger version. 

Name:	ScreenShot.jpg 
Views:	17 
Size:	88.7 KB 
ID:	32481
    Attached Thumbnails Attached Thumbnails ScreenShot1.jpg  

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    There is a missing single quote in front of the strJobNum - text fields need to be surrounded by quotes.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Both apostrophes are missing.

    " AND JobNum = '" & strJobNum & "'",
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. OpenForm with multiple search criteria and wildcards
    By guitarzycki in forum Programming
    Replies: 6
    Last Post: 01-18-2018, 08:45 AM
  2. DoCmd.OpenForm with multiple macros
    By Ekhart in forum Access
    Replies: 2
    Last Post: 03-02-2017, 01:38 PM
  3. Replies: 2
    Last Post: 01-26-2017, 03:53 PM
  4. DoCmd.OpenForm Syntax Error
    By alsoto in forum Forms
    Replies: 3
    Last Post: 02-29-2012, 01:14 PM
  5. What actually happens at docmd.openform
    By Beorn in forum Programming
    Replies: 4
    Last Post: 01-05-2011, 02:19 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