Run-time error 3075 syntax error (missing operator) open on double click from listbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gilley178
    New Member
    • Jun 2020
    • 10

    Run-time error 3075 syntax error (missing operator) open on double click from listbox

    Hello,
    My goal is to open a specific record from a list box to populate a different form with that specific data that was double clicked on. My column name is Claim ID 15 on the list box and in the master table that contains all data. This column contains values such as C123456789. On the Master table, Claim ID 15's data type is short text. When I double click on the row in the list box it gives me the following error: Run-time error '3075': syntax error (missing operator)in query expression '[Claim_ID_15=C12 3456789'.

    Code:
    Private Sub SearchList_DblClick(Cancel As Integer)
        DoCmd.OpenForm "profileForm", , , "Claim ID 15=" & SearchList
    
    End Sub
    I have a rudimentary understanding of visual basic, thank you in advance.
  • SioSio
    Contributor
    • Dec 2019
    • 272

    #2
    Hi.
    Maybe

    "Claim ID 15 = '" & SearchList & "'"

    Comment

    • Gilley178
      New Member
      • Jun 2020
      • 10

      #3
      Thank you for the response. I updated the code and it to:

      Code:
      Private Sub SearchList_DblClick(Cancel As Integer)
          DoCmd.OpenForm "profileForm", , , "Claim ID 15= '" & SearchList & "'"
      
      End Sub
      However it still resulted in a runtime error with the same message.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You should avoid spaces in object names. If you do use them, you have to surround the name in square brackets. Otherwise it has no way of knowing when a name begins and when it ends.

        Comment

        • Gilley178
          New Member
          • Jun 2020
          • 10

          #5
          Thank you for the advice! I made the following changes and it worked:

          Code:
          Private Sub SearchList_DblClick(Cancel As Integer)
              DoCmd.OpenForm "profileForm", , , "[Claim ID 15]='" & SearchList & "'"
          
          End Sub

          Comment

          Working...