| | |
|
|
|
Problems openingusing VBA Access from Excel |
| message from Jan Kr on 2 Jun 2004 |
I try to open an Access database from Excel, using the following code
Sub OpenDatabase()
strdb = "c:\demo.mdb"
Set appaccess = CreateObject("Access.Application")
appaccess.Visible = True
appaccess.OpenCurrentDatabase strdb
appaccess.DoCmd.OpenForm "frmsysteminformation"
Set appaccess = Nothing
End Sub
It works Ok, and dispalys the form. My problem is, I do not want to display
a form, only the database window. If I leave out the line
appaccess.DoCmd.OpenForm "frmsysteminformation"
or ad
appaccess.DoCmd.Close
the database opens, but closes dwon immediately. Is there any way to start
Access, open the database, and display the database window?
Jan
|
| Douglas J. Steele replied to Jan Kr on 2 Jun 2004 |
I believe the problem is that you're setting appaccess to Nothing at the end
of the routine. That closes it.
One thing you could try doing is opening your form as hidden.
appaccess.DoCmd.OpenForm "frmsysteminformation", , , , , 1
or
appaccess.DoCmd.OpenForm FormName:="frmsysteminformation", WindowMode:= 1
|
| Jan Kronsell replied to Douglas J. Steele on 2 Jun 2004 |
Removingthe Set appaccess = nothing makes no difference. But opening the
form hidden does, solve my problem. Then of course another problem occurs.
Some of my databases do not have any forma in them. So they wont display at
all.
Jan
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> skrev i en
meddelelse news:#EOVLyNSEHA.2216@TK2MSFTNGP12.phx.gbl...
|
|
Archived message: Problems openingusing VBA Access from Excel (Microsoft Access Database)