shell open db

spinkung

Registered User.
Local time
Today, 14:43
Joined
Dec 4, 2006
Messages
267
Hi All,

I'm trying to open a db using the shell command. I keep getting an invalid procedure call though??

here's what i have...
Code:
Dim rpt_db As String
rpt_db = GetDBPath & "WarePro_RPT_prod.mdb"
Shell rpt_db, vbHide

...but it's not working. i've had a look about and tried a couple of other things like ....
Code:
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
                    (ByVal hwnd As Long, ByVal lpOperation As String, _
                    ByVal lpFile As String, ByVal lpParameters As String, _
                    ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Const SW_HIDE As Long = 0
Private Const SW_SHOWNORMAL As Long = 1
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Const SW_SHOWMINIMIZED As Long = 2

sub button1_Click()
ShellExecute Me.hwnd, "Open", rpt_db, vbNullString, GetDBPath, 
SW_SHOWNORMAL
end sub

which does nothing at all just runs through the code and nothing happens?

can anyone help??

thanks, spin.
 
What is the reason you want to open a further mdb and have it hidden? It may be you do not need to go down this route.

David
 
well, i'm using the db to run a report and save to disk but the report takes about 2/3mins to run which locks the database so it cant be used.

i was hoping to have a smaller db to perform the task of running the report which will hopefully release the main front end db to be used??
 
Sounds like to me that you db is not set up correctly. Is the database split? Is it running accross a network? Has it always been slow?

More info

David
 
it's a newbie.

I have 3 areas which i'm reporting on which are 3 dept KPI's.

the data comes frmo various sources:
tables linked to SQL server
tables within access
quite a few queries and crosstabs

The db is split and sits on a network drive.
 
Try this:

Code:
Dim objShell As Object
Dim rpt_db As String
 
Set objShell = CreateObject("Shell.Application")
 
rpt_db = GetDBPath & "WarePro_RPT_prod.mdb"
 
objShell.ShellExecute rpt_db, , , , 0

Tested Access 2007
 

Users who are viewing this thread

Back
Top Bottom