Re: Deleting a table in the backend using VBA

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



You've described "how" you want to do something (delete a back-end table
from a front-end). If you'll provide a bit more specific description of
"why" and "what", the folks here in the newsgroup may be able to offer
alternative (and more specific) suggestions.

For example, if you need a place to temporarily store an intermediate work
product, you could create (in the back-end) a "temp" table, then use queries
in the front-end to clear it out (delete query) and reload it with the new
set of data (append query).

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Giem" <Giem@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C6B854B5-67E2-45E1-93F4-40D4B5CF3F70@xxxxxxxxxxxxxxxx
Hey all,

I am trying to delete a table in the backend database using code in the
button on the frontend.
I know there was a post already answered concerning this, the answer using
this example:

Dim dbCurr As DAO.Database

Set dbCurr = OpenDatabase("E:\Folder\BackEnd.mdb")
dbCurr.TableDefs.Delete "MyOldTable"

My problem is, it's not actually deleting the table. I know this because
afterward there is a query executed that remakes the table. It gives me
the
error "Table 'X' already exists." If you open the backend after stepping
past
the delete part, it is still there as well, And I am making sure the
backend
is not open or locked in any way when this is running.

I was also wondering about DeleteObject, having the backend database
checked
as a library reference. As I understood, Access will look at a library
object
first with certain syntax? There is a link to this table in question in
the
frontend, for querys used in the frontend afterwards. I want to avoid
getting
that included in the mix.

Anyway, an explanation of what could be missing on my part for the DAO
method, alternatives to the DAO method, making a make table query to just
shut up and do it and wipe the old one, or another way of doing it
altogether
is greatly appreciated. :)


.


Quantcast