Open Access Application

J

John

I am creating an Access database in VB, using:

Dim db AS DAO.Database
Dim td AS DAO.TableDef
Set db = DBEngine.CreateDatabase("DbaseName",
dbLangGeneral)
Set td = db.CreateTableDef("TableName")
With td
.Fields.Append .CreateField("First Name", dbText)
.Fields.Append .CreateField("Last Name", dbText)
End With
db.TableDefs.Append td
db.close
Set db = Nothing
Set db = Nothing

This works OK and the new database is created, but after
executing this code I have a minimised Access open and not
showing any database (i.e. just the application open and
minimised). Access stays open until I stop Visual Basic
and then it dissapears, so it would seem that something in
Visual Basic is keeping Access open.

What can I do in VB so that I do not get this open Access
Application after creatring my database?
 
V

Van T. Dinh

If you meant the stand alone Visual Basic then I am sure
the problem is some other parts of your code. AFAICS, the
posted code only uses VB and DAO to create a JET mdb
database and got nothing to do with Access.

HTH
Van T. Dinh
MVP (Access)
 
Joined
Apr 24, 2008
Messages
1
Reaction score
0
I have already to create database with MS-Access 2003, but I can not open Database with VB scrpt in MS-Access :

Private Sub Label9_Click()
Dim appaccess As Access.Application, dbstr As String

On Error Resume Next
Set appaccess = New Access.Application
Set appaccess = CreateObject("Access.Application")
dbstr = App.Path & "E:\Helpdesk PPM\PPM\PPM NMC 08042008.mdb"
appaccess.OpenCurrentDatabase dbstr
appaccess.DoCmd.OpenForm "MenuUtama", acNormal
appaccess.Visible = True

End Sub

Thanks your cooperation.

Diantono S.
Email : (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top