0
votes

I have an access front end that is designed to view and modify the back end database. It is set up to allow users logging in thru the front end to select an existing back end thru an Open Dialog Window.

However, how would I go about allowing the user to create a new back end from within the front end?

1

1 Answers

2
votes

Using an ADOX catalogue

Dim cat
Set cat = CreateObject("ADOX.Catalog")

With cat
    .create "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=z:\docs\new.accdb"

    With .ActiveConnection
        sSQL = "CREATE TABLE T1 (ID Counter Primary Key, AText Text(20))"
        .Execute sSQL
    End With
End With

Basing the new DB on an existing DB.

Dim fs As Object 'FileSystemObject
Set fs = CreateObject("Scripting.FileSystemObject")
FileName = CurrentProject.Path & "\New.accdb"
If Not fs.FileExists(FileName) Then
    fs.copyfile CurrentProject.FullName, FileName, False
End If