Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2008
    Posts
    8

    Question Unanswered: Missing operator error

    Hello there, need some help.

    Can someone please point out where the missing operator is?

    The following code works fine:

    Set rst = CurrentDb.OpenRecordset("SELECT * FROM Pedimentos WHERE Format([PedimentoFecha],'mm') = '" & Me!cboPeriodo.Column(1) & "'" & _
    "And ProcesadoAnexo31 = " & False)

    but if I add the following flag (highlighted red), it fails with the "missing operator" error

    Set rst = CurrentDb.OpenRecordset("SELECT * FROM Pedimentos WHERE Format([PedimentoFecha],'mm') = '" & Me!cboPeriodo.Column(1) & "'" & _
    "And ProcesarAnexo31 = " & True & "And ProcesadoAnexo31 = " & False)

    I just can't seem to find where my syntax is wrong.

    Thanks in advance.
    Carlos

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    630
    Provided Answers: 34
    True and false remain INSIDE the quotes.

    If you put this in a query,you don't need to breakup controls In SQL with quotes.
    Last edited by ranman256; 07-20-17 at 16:04.

  3. #3
    Join Date
    Mar 2008
    Posts
    8

    Thumbs up

    Quote Originally Posted by ranman256 View Post
    True and false remain INSIDE the quotes.

    If you put this in a query,you don't need to breakup controls In SQL with quotes.
    Code is in VBA, I was given a suggestion that worked perfectly, there needs to be a space after the quotes when 'And' is used.

    example:

    " And ProcesarAnexo31 = " & True & & " And ProcesadoAnexo31 = " & False)

    Thanks ranman

Posting Permissions

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