Results 1 to 10 of 10
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    temp tbl

    All, using access 2010. I have code to delete a temp file before processing more code.

    Code:
    DoCmd.DeleteObject
    acTable, "tbl_temp"
    Sometimes; users would start the process and stop for some reason or another. This doesn’t happen often but I would like to avoid the errors. What happens now is a pop up tells them the temp table is not found and just hangs. I know I need to put error trapping but need the correct error trapping. I want them to be able to go beyond that point. Ideally; I want them to not even become aware that the table is not there but just go on to the next step without them knowing the table is not there. Can anyone help with error trapping and message pls.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You can add normal error handling:

    http://www.baldyweb.com/ErrorTrap.htm

    but for that specific error number use

    Resume Next

    and no message box.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sounds like you are using a make table query. I don't use make table queries because they have been known to cause corruption. Also, constantly creating and deleting tables causes dB bloat.

    I create the temp table, then delete all records before I append the new data.
    If a table is being created over and over, it is important to create it once and just delete the records..(IMO)


    My $0.02....

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I also use temp table - 'temp' means records are temporary, not the table. As Steve said, just purge the table before the process that uses it. No error.

    Also, if this is a split db (should be with multiple users), the temp table goes in the frontend.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Ok. The temp table is in the frontend used to import data and in case there are errors we can catch before appending to the main tbl. But as stated; a user may start the code which is to delete the old temp table then realize something or some other reason stop the next part of the code from running. Then upon the return to run the code, the temp table is not there and the code does not go forward. I'll try the error handling with resume next. I thought there was a way to just skip that part of the code and go on since this is the first step in the code and doesn't matter if there is a temp tbl because it would be replace anyway. Thanks

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Still advise is best to just delete records then there will not be an error to deal with. Also, eliminates the issues of db corruption and bloat.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    so delete records and append the data? No use for temp tbl????

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Did not say that. Use temp table but don't delete and re-create table. Delete records from temp table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I totally agree with June. That is the way I use the temp table. Delete the records, NOT the table.

  10. #10
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Thanks All!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 08-09-2013, 12:04 AM
  2. delete temp table
    By slimjen in forum Queries
    Replies: 1
    Last Post: 07-19-2012, 06:35 AM
  3. Query for temp linked table
    By compooper in forum Programming
    Replies: 8
    Last Post: 06-30-2011, 06:53 AM
  4. sql temp table creation for form
    By Ian_ in forum Forms
    Replies: 2
    Last Post: 06-17-2011, 03:27 AM
  5. Question About Temp Tables
    By Rawb in forum Database Design
    Replies: 4
    Last Post: 11-29-2010, 10:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums