0

Here's a piece of vbs code that creates an Access database.

option explicit

dim accessFile
dim acc
dim fso

accessFile = "c:\users\rene.nyffenegger\documents\tq84.accdb"

set fso = createObject("Scripting.FileSystemObject")

if fso.fileExists(accessFile) then
   fso.deleteFile(accessFile)
end if

set acc = createObject("Access.Application")

acc.newCurrentDatabase accessFile, 0

acc.visible = True

When started on the command line (u:\> createDB.vbs), the Access database is created. Yet, when the script exits the Access application is closed as well. I'd rather have the application stay open after creation. Is this somehow possible?

1 Answer 1

1

Try setting the Application's UserControl property to True.

Set acc = CreateObject("Access.Application")
acc.NewCurrentDatabase accessFile, 0
acc.Visible = True
acc.UserControl = True
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.