Results 1 to 7 of 7
  1. #1
    moneypennie21 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    41

    SYNTAX ERROR 3075 Missing operator

    Hi,


    I am trying to open a form at a specific record using a combo box. the combo box is Combo23 the form I am opening is called Frm_Visit_Details the field on the form I want to use to determine which record to open is called Visit_ID I have created a button with a click event to open the form and the code I am using is:

    Private Sub Command5_Click()

    DoCmd.OpenForm "Frm_Visit_Details", acNormal, , "[Visit_ID] = " & Me.Combo23 & """"""

    End Sub

    where am I missing an operator, I have tried various combinations of " and ' and can't seem to get it to work properly.

    Thanks

    J

  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
    Try deleting everything after 23. Here's a reference:

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    if VISIT ID is numeric, you dont need the extra quotes:

    DoCmd.OpenForm "Frm_Visit_Details", , , "[Visit_ID] = " & Me.Combo23

  4. #4
    moneypennie21 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    41
    Hi I have removed the extra quotes leaving the following code:

    Run time error 3464
    Data typr mismatch in criteria expression

    the Visit_ID is a text field in the table

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Use apostrophes as delimiter for text field parameter, easier to read:

    Code:
    DoCmd.OpenForm "Frm_Visit_Details", , , "[Visit_ID] = '" & Me.Combo23 & "'"
    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.

  6. #6
    moneypennie21 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    41
    Hi pbaldy using the info on your link I have fixed it now as the Visit ID was a text value I have put in the following:

    Private Sub Command5_Click()


    DoCmd.OpenForm "Frm_Visit_Details", , , "Visit_ID = '" & Me.Combo23 & "'"


    End Sub

    and it now works ok Thanks so 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!
    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: 01-04-2016, 09:40 AM
  2. Replies: 2
    Last Post: 09-10-2014, 11:30 AM
  3. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Syntax error missing operator(3075)
    By parisienne in forum Programming
    Replies: 1
    Last Post: 04-07-2011, 02:29 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