Full Version: Opening a form in another database
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
wesley
Hi,

Is there a way of opening a form in another database? I'm thinking of having a some kind of button on one form that links to another form in another database but I don't know what code i should use.

Thanks
Larry Larsen
Hi
Check this link out: Open a form in an external database.
HTH's
thumbup.gif
wesley
Thanks, but my knowledge of VBA is limited so where do I specify the form to open and the database? How do I make this a button?
Larry Larsen
Hi
It's a function and should be placed in a module, be careful not to use the same name for the module as the function.
The function can then be called from behind a command button:
eg:
Call fOpenRemoteForm("DBPath/Name.mdb","FormName",Optional intView As Variant) As Boolean

thumbup.gif
wesley
I'm having trouble getting this function to work. Can the path and the name of the form have spaces in? I get syntax errors when I call the command:
CODE
   Call fOpenRemoteForm("H:\Exams\Special Circs\Special Circs.mdb","Students Frm") As Boolean
Larry Larsen
Hi
LOL.. I dont know I don't have "spaces" in my db/form names..
Try placing a bracket around them..eg:
Call fOpenRemoteForm("H:\Exams\[Special Circs]\[Special Circs.mdb]","[Students Frm]") As Boolean
HTH's
thumbup.gif
jhardy66
You could also set the File Path and the File Name into Strings, then put the string name into the fOpenRemoteForm call.
Just another suggestion.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.