Results 1 to 3 of 3

Thread: PLEASE correct my SQL statement!!!!!!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    98
    When I run my vb app I get the following error message:

    Run Time error ‘3075’

    Syntax error (missing operator) in query expression ‘Date1>=#01/01/2999# AND Date2<=#01/31/2000# And City = ‘NY# AND State = ‘New York’


    Here is my SQL query:
    It takes a snap shot of what is in the db and places it into a temp db the variable is strtempDB


    db.Execute "SELECT * INTO Places IN '" & strTempDb & "' FROM Places WHERE Date1>=#" & Format(datFromDate, "mm/dd/yyyy") & "# AND Date2<=#" & Format(datToDate, "mm/dd/yyyy") & "# AND City = '" & (datCity.Text) & "# AND State = '" & (datState.Text) & "'"


    Can someone please correct the errr I am encountering:
    The problem is either the ' " or the #

    Help is appreciated,
    Stevie

  2. #2
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373

    Arrow

    You're right...

    the missing sign is ' after the city= 'NY' you left out the second '

    hope it helps...


    Code:
    db.Execute "SELECT * INTO Places IN '" & strTempDb & "' FROM Places WHERE Date1>=#" & Format(datFromDate, "mm/dd/yyyy") & "# AND Date2<=#" & Format(datToDate, "mm/dd/yyyy") & "# AND City = '" & (datCity.Text) & "' AND State = '" & (datState.Text) & "'"
    Saludos...
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    98
    Here is the correction I made:

    db.Execute "SELECT * INTO Places IN '" & strTempDb & "' FROM Places WHERE Date1>=#" & Format(datFromDate, "mm/dd/yyyy") & "# AND Date2<=#" & Format(datToDate, "mm/dd/yyyy") & "# AND City = '" & (datCity.Text) & "' AND State = '" & (datState.Text) & "'"

    Here is what you wrote as the correction:

    the missing sign is ' after the city= 'NY' you left out the second '

    db.Execute "SELECT * INTO Places IN '" & strTempDb & "' FROM Places WHERE Date1>=#" & Format(datFromDate, "mm/dd/yyyy") & "# AND Date2<=#" & Format(datToDate, "mm/dd/yyyy") & "# AND City = '" & (datCity.Text) & "' AND State = '" & (datState.Text) & "'"


    Gives me the same err

    Steve


Posting Permissions

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



Click Here to Expand Forum to Full Width