Results 1 to 6 of 6

Thread: Sql Statement

  1. #1
    Join Date
    Jun 2006
    Posts
    48

    Unhappy Unanswered: Sql Statement

    This sql statement has a syntax error. Could someone please point out what is wrong?

    strSQL = "INSERT INTO tblChequesRetrieval SELECT * FROM tblChequesA IN '" & DataSource & "' WHERE ChequeNo = & Forms![frmRetrievePeriod].[ChequeNo]&"

    Thanks

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Well off hand, it's incomplete/invalid ... And as for syntactically, that depends on the error generated (which you did not say what it was) to determine where/what the syntax error is ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Jun 2006
    Posts
    48
    Oh sorry, for posting this problem twice.

    I got the sql statement to work.
    Here is the correct format:COLOR="DarkRed"]
    strSQL = "INSERT INTO tblChequesRetrieval SELECT * FROM tblChequesA IN '" & DataSource & "' WHERE [ChequeNo] = '" & Forms![frmRetrievePeriod].[ChequeNo] & "';"[/COLOR]

    It didn't have the right format in terms of quotations and such.

    Thanks for looking at it though.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What is your intention with that " IN " statement?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    My guess is that the source table is not in the db the SQL is in (nor is it linked). In that instance, the "IN" clause can be used to specify where it can be found.
    Paul

  6. #6
    Join Date
    Jun 2006
    Posts
    48
    You are right, pbaldy!

    I am retrieving data from an archived table that is in another instance of MS Access or in another database and yeah, the IN is used to specify where it is found and the data source was stated in my declarations.

Posting Permissions

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