Syntax Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GLEberts
    New Member
    • Mar 2008
    • 51

    #1

    Syntax Error

    I am getting the following error when I click on a command button.

    Runtime error 3075
    Syntax error (missing operator) in query expression "[jobinvoiceid]'=.


    I have a main form "fmjob" with a subform "fmjobinvoi ce"
    both are linked together by "jobId" and "jobinvoice id"

    I have a command button with on the click handler:
    Private Sub Command1158_Cli ck()
    DoCmd.RunComman d acCmdSaveRecord
    DoCmd.OpenRepor t "rptjobinvoice" , acViewPreview, , "[jobinvoiceid]=" & JobinvoiceID

    End Sub

    what I am trying to do is open up a report to view a specific record.

    I have this in a few places in my DB on my main forms only not on the subforms and it works fine.

    I have worked this a ton of different ways and can't seem to come up with the fix.

    thanks for any suggestions.
    Gary
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    This syntax

    "[jobinvoiceid]=" & JobinvoiceID

    is only correct if the jobinvoiceid field is defined in your table as a Number. Is it?

    IF it's defined as Text then

    "[jobinvoiceID] = '" & JobinvoiceID & "'"

    would be correct.

    Where is Command1158 located and where is JobinvoiceID located, form-wise?

    Linq ;0)>

    Comment

    • GLEberts
      New Member
      • Mar 2008
      • 51

      #3
      JobInvoiceID is defined in my table as a "AutoNumber "


      Command Button 1158 is placed on the subform "fmjobinvoi ce" not the main form "fmjob"

      "JobInovice ID is placed in the subform "fmjobinvoi ce" not the main form "fmjob"

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        What is the exact text in the error message you are getting?
        "[jobinvoiceid]'=.
        Either the error message or your code has not been transferred correctly.

        Comment

        • OldBirdman
          Contributor
          • Mar 2007
          • 675

          #5
          Could JobinvoiceID be Null? That would fit the error message. How about Debug.Print JobinvoiceID?

          Comment

          Working...