View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default Open/Close CurrentDatabase

do you really want to open Access and then open the database?
Usually one would only want to extract/edit data, and you can do this via
ADODB ... connecting and executing a command or a SQL select statement o
populate a recordset, which can then be used to populate a table, pivotcache
or whatever.

"Hydra" wrote in message
...


Set appAccess = CreateObject("Access.Application")
appAccess.Visible = True
appAccess.CloseCurrentDatabase

This throws an error that says the expression refers to an object that is
closed or does not exist.

------------------

Set appAccess = CreateObject("Access.Application")
appAccess.Visible = True
appAccess.OpenCurrentDatabase ("DataCheck")

Throws an error that says the object is missing or open by another user.

-------------------

Set appAccess = CreateObject("Access.Application")
appAccess.Visible = True
appAccess.NewCurrentDatabase ("DataCheck")

Creates a new Database Called "DataCheck" and displays it, Provided
DataCheck does not already exist. If it does exist it throws an error
saying
there is an existing database with that name.

-------------------------------------------------------------------

I want to create this file and populate it with data from an Excel sheet,
But if it already exists then I want to kill it and create a new one from
scratch because the columns of data in the Spreadsheet may change.

Or at very least, open the existing file and empty all the data before I
repopulate it.