var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Create new database feature
Hi, I want to do the following:
1. Create a blank access database
2. Copy tables from one database to this blank one, copying structure only, not tables
3. Do a compact and repair on the database created.
Now, we use a access DB for the front end and an access DB for the back end.
I want to do this on the backend database, not the front end database.
I pretty much understand the concept of importing tables using the transfer command but how can I create a blank database within VBA code?
Thanking you all in advance
have a look at the NewCurrentDatabase method in the help files
What about copying the existing file, deleting all the data in each table and then compacting? Might be easier to program. The compact will reset any autonumber fields you have back to 1.
Give this a shot
Once you create a copy of the DB try this.
This cycles through each table in the database, dynamically creates an SQL statement and deletes all records for not system tables.
Public Sub CleanItOut()
Dim tDef As TableDef
Dim db As Database
Dim sql As String
Set db = CurrentDb
For Each tDef In db.TableDefs
If Not Left(tDef.Name, 4) = "msys" Then
sql = "DELETE * FROM " & tDef.Name
set db = nothing