Problem with opening a database from another database

Datafiend

Registered User.
Local time
Tomorrow, 01:11
Joined
Sep 11, 2009
Messages
11
Hi there
I'm following the code that appears in a number of posts about how to open one database from another database. I'm using the following code:

Code:
Private Sub Command0_Click()
Dim appAccess As Access.Application ' Create instance of Access Application object.
Set appAccess = CreateObject("Access.Application")
' Open MyDatabaseName.mdb database in Microsoft Access window.
appAccess.OpenCurrentDatabase “S:\2336-PPR Apps\Data Access\Self Managed Teams\AT\Public Register & Gazettals.accdb", False 
 
.....

The line from appAccess.OpenCurrent Database appears red and if I try to compile the database I get a message 'Compile error: Syntax error' athe line appAccess.OpenCurrentDatabase "S:\2336....etc.

The drive and path name are correct as I have copied them from the folder.

Is anyone able to suggest what I am doing wrong.

Thanks in advance for any help.

datafiend
 
not sure if it is the way the forum has posted your code but this looks like the wrong type of quotation mark

appAccess.OpenCurrentDatabase S:\2336...

it should be "
 
Hi,

Not knowing what version of Access your are using, the following is the code I use in Access 2000:

Code:
DoCmd.Echo False, "Running Open Questionnaire  Program"
DoCmd.Hourglass True                                                                                            'Turn on the Hour Glass
DoCmd.SetWarnings False                                                                                         'Turn Off the Warnings
intX = Shell("C:\Program Files\Microsoft Office\Office\msaccess.exe G:\Questionnaires.mdb", vbMaximizedFocus)   'Open Questionnaire Database
DoCmd.Echo True, ""
DoCmd.Hourglass False                                                                                           'Turn Off the Hour Glass
DoCmd.SetWarnings True                                                                                          'Turn on the Warnings
DoCmd.Quit

Obviously you will need to change the Path "G:\Questionnaires.mdb" to what you need for your database, I've been using this for years and it works fine.

Regards

John
 
Hi guys
Thanks very much for your help. CJ ;you are very observant. Changing the quotation marks fixed that problem.

John, I'm using Access 2010 and when I try your code I get a 'Run-time error '5': Invalid procedure or call argument.

datafiend
 

Users who are viewing this thread

Back
Top Bottom