syntax error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dario90@gmail.com

    syntax error

    i have a problem connected with syntax error- in query i have that:

    SELECT DMax("Data","Pr acownicy na stacjach","Loka lizacja stacji = " &
    [Lokalizacja stacji] & " And Zmiana = " &[Zmiana] & " And
    Data<=#"&Data&" # ")
    FROM Bledy;

    (Translation: Pracownicy na stacjach= Emploees on work stations,
    Lokalizacja stacji= Work station location, Zmiana=shift)

    Only the criteria for Data work properly- for Zmiana and Lokalizacja
    it returns syntax error. What can be the reason for that? Maybe the
    fact that i'm looking for Data in this function and these 2 mistaken
    criterias have text values not data.
  • Roger

    #2
    Re: syntax error

    On May 15, 1:19 am, dari...@gmail.c om wrote:
    i have a problem connected with syntax error- in query i have that:
    >
    SELECT DMax("Data","Pr acownicy na stacjach","Loka lizacja stacji = " &
    [Lokalizacja stacji] & "  And Zmiana = " &[Zmiana] & " And
    Data<=#"&Data&" # ")
    FROM Bledy;
    >
    (Translation: Pracownicy na stacjach= Emploees on work stations,
    Lokalizacja stacji= Work station location, Zmiana=shift)
    >
    Only the criteria for Data work properly- for Zmiana and Lokalizacja
    it returns syntax error. What can be the reason for that? Maybe the
    fact that i'm looking for Data in this function and these 2 mistaken
    criterias have text values not data.

    if Zmiana and Lokalizacja are text fields, you need single quotes,ie
    SELECT DMax("Data","Pr acownicy na stacjach","Loka lizacja stacji = '"
    &
    [Lokalizacja stacji] & "' And Zmiana = '" &[Zmiana] & "' And
    Data<=#"&Data&" # ")
    FROM Bledy

    so for example
    "Lokalizacj a stacji = "
    becomes
    "Lokalizacj a stacji = '"
    ^- this is a single quote, followed by
    a double quote

    "' And Zmiana = '" &[Zmiana] & "'
    ^- double quote, single quote

    "' And Zmiana = '" &[Zmiana] & "'
    ^- single quote, double quote

    "' And Zmiana = '" &[Zmiana] & "'
    ^- single quote, double
    quote

    Comment

    Working...