Re: how to delete an object in another db



Slight typo. Marsh put comma Delete rather than period Delete.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Marshall Barton" <marshbarton@xxxxxxxxxx> wrote in message
news:rpjo73tdrnaolfdrrjr8dnvsjuv0vbdguj@xxxxxxxxxx
Wez.k wrote:

"Marshall Barton" wrote:

Wez.k wrote:
Could anyone tell me if its possible to delete an object such as a
table,
form, query etc in another database, and if so how is it done?


Open the other mdb file and operate on its db object

Dim otherDb As Database
Set otherDb = OpenDatabase("path to other mdb file")

otherDb.TableDefs,Delete "sometable"


Thanks for your reply. However there seems to be a syntax error with the
TableDefs line because the code window is showing it in red. Also, will
this
method work for forms, queries and reports?


I don't see what you tried, so I can't spot any syntax
errors.

The Delete method will also work for queries, but not for
forms or reports.

It might be better if you used Automation so you can employ
SelectObject and DeleteObject.

OTOH, This is starting to sound like an attempt to update an
existing database with modified forms, reports, etc. If so,
it is not a good idea. Instead you should distribute a new
front end mdb and use SQL DDL statements to modify the
backend tables.

--
Marsh
MVP [MS Access]


.



Relevant Pages

  • Re: Specifications and Limits of Access (2000,2003)
    ... Microsoft Access database (.mdb) file size 2 gigabytes. ... Modules (including forms and reports with the HasModule property set ... optimization with code modules that are the same, ...
    (comp.databases.ms-access)
  • RE: Best way to protect a shared MSAccess database...
    ... Besides the .mdb file permissions itself, ... puts all of the data into one .mdb and all of the forms, reports, querys, etc ... Database Utilities to compact current.mdb (this reclaims the file space ... Startup and uncheck the Allow Full Menus option. ...
    (microsoft.public.windows.server.sbs)
  • Re: web-accessing a database
    ... > running pre-written reports to manipulate the data and would not be ... > database application. ... Record locking shouldn't be an issue if the users are read only. ... There's one .mdb that just contains the data & sits on the ...
    (uk.rec.motorcycles)
  • Re: Editing fields in a linked table
    ... Dave Hargis, Microsoft Access MVP ... "Jeff Boyce" wrote: ... you cannot do it easily from the front end database. ... have to make the change in the database file (mdb, ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Question about Access coding practice/process...
    ... > "Sandra Daigle" wrote in message ... >> queries, modules, reports) and a backend mdb. ... >> [Microsoft Access MVP] ... >>> are embedded in the Access MDB file, i.e., the code and the database ...
    (microsoft.public.access.formscoding)

Loading