Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Syntax error (Access 2000)

    I am filtering the form depending on the option box called office but i get the syntax error 3075 missing operator.:
    Dim SQL As String
    SQL = " SELECT [Increment]+[invoice] AS Paymentid, orders.invoicedate, TblPaid.paid, Customers.CompanyName, affiliates.afid, affiliates.CompanyName, orders.paymentid AS invoice" & _
    " FROM ((orders LEFT JOIN TblPaid ON orders.orderid = TblPaid.orderid) INNER JOIN Customers ON orders.customerid = Customers.Customerid) INNER JOIN affiliates ON Customers.afid = affiliates.afid " & _
    " WHERE (((TblPaid.paid)=False Or (TblPaid.paid) Is Null) AND ((orders.paymentid)=True))"
    Dim StrOffice As String
    StrOffice = " WHERE orders.afid=" & Me.Office & ""
    Me.RecordSource = SQL & StrOffice
    What is wrong with my expression ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Syntax error (Access 2000)

    Your SQL string already contains the keyword WHERE, and strOffice adds a second WHERE. A valid SQL string may contain only one WHERE. Change the line that sets strOffice to

    StrOffice = " AND orders.afid=" & office

  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Syntax error (Access 2000)

    Thank you! it is fine now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •