Results 1 to 5 of 5

Thread: Temporary Table

  1. #1
    Join Date
    May 2003
    Posts
    144

    Unanswered: Temporary Table

    I have an adp and am trying to run the following statement in a form.

    docmd.runsql "SELECT ProdID, ProdName INTO #Test FROM tblProd"

    I keep getting the 2757 error. Can I not create a temporary this way in a form of an adp? Help!

    Thanks

    SHK

  2. #2
    Join Date
    Sep 2003
    Location
    Caldes de Malavella, Spain
    Posts
    244
    Your problem is the #257. You can't use a hash sign as part of a table name, as it is a date-delimiting character in SQL.
    Andy Briggs
    Elmhurst Solutions Limited
    Database Development and Consultancy
    http://www.elmhurstsolutions.com

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Unless you use the [] brackets ...
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    May 2003
    Posts
    144
    I have created and added data to the temporary table with the following statement.

    docmd.runsql "CREATE TABLE #Test(ProdID int, ProdName char(20))"
    docmd.runsql "INSERT INTO #Test SELECT ProdID, ProdName From tblProd"

    It works. I can see the data on the table when debug. However, I am still getting the 2757 error when I assign #Test as the recordsource of a report. Any suggestion of where should I look into, have I missed something, or temporary table is just simply does not work on a report of an adp? Help!

    Thanks

    SHK

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    drop the # from the temporary table name, even as M OWen says you can use it providing it is enclosed by square brackets.....

    The fact that you can create the table in a macro, doesn';t neccesarily mean you can read / view it elsewhere.

Posting Permissions

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