Results 1 to 3 of 3
  1. #1
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250

    Runtime error 3075 (missing operator) within DoCmd.OpenForm

    Hello everybody,

    I have a continuous form of customers and at the top I have a combo box where I can select any of them and then press button "Show details"

    I created this code:
    Code:
    Private Sub Command15_Click()
        Dim ChosenCustomer As String
        
        If IsNull(cboCustomer) Then
            MsgBox ("You need to choose a customer from the list.")
        Else
            ChosenCustomer = cboCustomer
            DoCmd.Close acForm, "frmCustomersOverview", acSavePrompt
            DoCmd.OpenForm "frmCustomerCard", , , "[CustomerName]=" & ChosenCustomer
        End If
    End Sub
    I choose, let's say, customer "Smith" from the list and hit the button.

    I get this error: Run-time error '3075': Syntax error (missing operator) in query expression: [CustomerName]=Smith.



    Can anyone help me here? What am I doing wrong?

    Thank you,
    Tomas

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    customername is a string so you must put delimiters around it...

    DoCmd.OpenForm "frmCustomerCard", , , "[CustomerName]='" & ChosenCustomer & "'"

  3. #3
    Thomasso is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250
    Perfect, thank you sir!

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. Access Run-Time Error 3075 - Missing Operator
    By dipitiduda2 in forum Access
    Replies: 2
    Last Post: 02-24-2014, 02:24 PM
  3. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  4. Syntax error missing operator(3075)
    By parisienne in forum Programming
    Replies: 1
    Last Post: 04-07-2011, 02:29 PM
  5. Error 3075 Missing Operator
    By KLynch0803 in forum Queries
    Replies: 5
    Last Post: 02-11-2010, 01:13 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