Opendatabase problem

MartinO

Registered User.
Local time
Today, 06:41
Joined
Oct 8, 2002
Messages
22
Hi, I'm trying to open one database from another usin the following code and using the click of a button to drive it.

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim PAX As String

PAX = "N:\\\\\\\review\XBD\XeBeDee.mdb"
OpenDatabase PAX

Exit Sub

Err_Command0_Click:
MsgBox Err.Description

End Sub

No errors jump out at me so I'm assuming the code is OK - however no matter how many times you click the button, nothin happens.

Any Ideas anyone?
 
How do you know nothing happens???

Looks to me like you are running code to try to add a db to the db collection.

If you actually want the db to open, meaning you want to launch the program, try something like:

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim PAX As String
Dim retval

PAX = "C:\Program Files\Microsoft Office\Office10\msaccess.exe C:\Test.mdb"
retval = Shell(PAX, 1)

Exit Sub

Err_Command0_Click:
MsgBox Err.Description

End Sub


HTH :cool:
 
Instead of actually opening it, I'd open a connection to it instead.

Perform searches on ADO.
 
Thanks guys - not quite there yet. Sam F perhaps I should have said I'm trying to get this to happen with Access 97. Using your code I get "Invalid procedure call or argument". I'm not sure that Access97 recognises 'retval'

Any other thoughts?
 

Users who are viewing this thread

Back
Top Bottom