Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2005

Tip: Looking for answers? Try searching our database.

Deleting a temp table issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Larry Hodges - 19 Jul 2005 21:03 GMT
Running Access 10

I have a form to launch my report.  The form creates a temp table for the
report to use.  When the report closes, I want to delete the temp table.

  DoCmd.DeleteObject acTable, "MyTempTable"

The above works if the report is already closed.  But if launching in the
Close event for the report, it doesn't.  I assume that's because the table
is in use.

I've tried creating a separate hidden form to launch from the report Close
event, assuming the dataset would be closed.  I've got the code in the
Activate event in the form, but it still errors out because the table is in
use.

Is there a way to close the table in the report itself, then delete the temp
table from there?  If not, how do I close the table before the form I've
created tries to delete it?

Thanks in advance...
Signature

-Larry

Rick Brandt - 19 Jul 2005 21:27 GMT
> Running Access 10
>
[quoted text clipped - 18 lines]
>
> Thanks in advance...

I would just empty and repopulate a table that is NOT deleted and recreated
each time.

In a broader sense temp tables best belong in temp files.  Otherwise they
lead to bloat of your main file.

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Larry Hodges - 19 Jul 2005 21:58 GMT
>> Running Access 10
>>
[quoted text clipped - 24 lines]
> In a broader sense temp tables best belong in temp files.  Otherwise
> they lead to bloat of your main file.

Why would that lead to bloating if you're deleting the table
programmatically each time?  How is that different from populating end
deleting the data in the table?
Signature

-Larry

Rick Brandt - 19 Jul 2005 22:08 GMT
>>> Running Access 10
>>>
[quoted text clipped - 28 lines]
> programmatically each time?  How is that different from populating end
> deleting the data in the table?

From a bloat standpoint they're both not good, but creating and deleting
even an empty table will cause some bloat so it is the worse of the two.  To
avoid bloat altogether you would use a table in a temp database, but that
doesn't address your original problem.  If you tried to delete the temp
database in the close event of your report the same error would occur
(attmepting to delete an object that is still in use).  However; regardless
of whether it is in the same file or a temp file emptying the contents of
the table instead of trying to delete it entirely can be done in the report
close event without a problem.

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Larry Hodges - 19 Jul 2005 22:13 GMT
>>>> Running Access 10
>>>>
[quoted text clipped - 39 lines]
> of trying to delete it entirely can be done in the report close event
> without a problem.

Yes, it does work....thanks.
Signature

-Larry

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.