If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Command button to open another database?
I have a command button on a form that opens another form within the same
database. Is it possible to have one that opens a separate database? Right now my code for the former is: Private Sub GoToCMLabels_Click() DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal, "", "", , acNormal DoCmd.Close acForm, "frmCMDMSearch" End Sub If possible, what would the code look like to open a separate DB? -- GD |
#2
|
|||
|
|||
Command button to open another database?
Access can only have one database open at a time, though you can be linked
simultaneously to many data files. You can however program a command button to open another instance of Access to show your other database. You can use the command button wizard to generate code similar to below: Private Sub btnOtherDB_Click() On Error GoTo Err_btnOtherDB_Click Dim stAppName As String stAppName = "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE FullPathName\MyApp.mdb" Call Shell(stAppName, 1) Exit_btnOtherDB_Click: Exit Sub Err_btnOtherDB_Click: MsgBox Err.Description Resume Exit_btnOtherDB_Click End Sub -Ed "GD" wrote in message ... I have a command button on a form that opens another form within the same database. Is it possible to have one that opens a separate database? Right now my code for the former is: Private Sub GoToCMLabels_Click() DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal, "", "", , acNormal DoCmd.Close acForm, "frmCMDMSearch" End Sub If possible, what would the code look like to open a separate DB? -- GD |
#3
|
|||
|
|||
Command button to open another database?
2007 Can have two DB open at once, I’m not sure about the others. The
easiest way I have found to do this with a button is to use a Macro with the ACTION (RunApp) and the COMAND LINE something like ("C:\Program Files\Microsoft Office\OFFICE12\Access.EXE" "C:\File\AccessFileName.mdb") The file locations will change. Make sure you use the quotes. Hope this helps Kevbro "Ed Robichaud" wrote: Access can only have one database open at a time, though you can be linked simultaneously to many data files. You can however program a command button to open another instance of Access to show your other database. You can use the command button wizard to generate code similar to below: Private Sub btnOtherDB_Click() On Error GoTo Err_btnOtherDB_Click Dim stAppName As String stAppName = "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE FullPathName\MyApp.mdb" Call Shell(stAppName, 1) Exit_btnOtherDB_Click: Exit Sub Err_btnOtherDB_Click: MsgBox Err.Description Resume Exit_btnOtherDB_Click End Sub -Ed "GD" wrote in message ... I have a command button on a form that opens another form within the same database. Is it possible to have one that opens a separate database? Right now my code for the former is: Private Sub GoToCMLabels_Click() DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal, "", "", , acNormal DoCmd.Close acForm, "frmCMDMSearch" End Sub If possible, what would the code look like to open a separate DB? -- GD |
#4
|
|||
|
|||
Command button to open another database?
Hey Ed. Your solution works great, but I'm running into a problem because
one of the subfolders I have to use to get to the new DB has a space in it. Is there a way to alter the code to account for that? I don't have the option of changing the folder name. -- GD "Ed Robichaud" wrote: Access can only have one database open at a time, though you can be linked simultaneously to many data files. You can however program a command button to open another instance of Access to show your other database. You can use the command button wizard to generate code similar to below: Private Sub btnOtherDB_Click() On Error GoTo Err_btnOtherDB_Click Dim stAppName As String stAppName = "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE FullPathName\MyApp.mdb" Call Shell(stAppName, 1) Exit_btnOtherDB_Click: Exit Sub Err_btnOtherDB_Click: MsgBox Err.Description Resume Exit_btnOtherDB_Click End Sub -Ed "GD" wrote in message ... I have a command button on a form that opens another form within the same database. Is it possible to have one that opens a separate database? Right now my code for the former is: Private Sub GoToCMLabels_Click() DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal, "", "", , acNormal DoCmd.Close acForm, "frmCMDMSearch" End Sub If possible, what would the code look like to open a separate DB? -- GD |
#5
|
|||
|
|||
Command button to open another database?
Just enclose the folder/file name in double quotes ("xx").
"GD" wrote in message ... Hey Ed. Your solution works great, but I'm running into a problem because one of the subfolders I have to use to get to the new DB has a space in it. Is there a way to alter the code to account for that? I don't have the option of changing the folder name. -- GD "Ed Robichaud" wrote: Access can only have one database open at a time, though you can be linked simultaneously to many data files. You can however program a command button to open another instance of Access to show your other database. You can use the command button wizard to generate code similar to below: Private Sub btnOtherDB_Click() On Error GoTo Err_btnOtherDB_Click Dim stAppName As String stAppName = "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE FullPathName\MyApp.mdb" Call Shell(stAppName, 1) Exit_btnOtherDB_Click: Exit Sub Err_btnOtherDB_Click: MsgBox Err.Description Resume Exit_btnOtherDB_Click End Sub -Ed "GD" wrote in message ... I have a command button on a form that opens another form within the same database. Is it possible to have one that opens a separate database? Right now my code for the former is: Private Sub GoToCMLabels_Click() DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal, "", "", , acNormal DoCmd.Close acForm, "frmCMDMSearch" End Sub If possible, what would the code look like to open a separate DB? -- GD |
#6
|
|||
|
|||
Command button to open another database?
Awesome! Thanks again, Ed.
-- GD "Ed Robichaud" wrote: Just enclose the folder/file name in double quotes ("xx"). "GD" wrote in message ... Hey Ed. Your solution works great, but I'm running into a problem because one of the subfolders I have to use to get to the new DB has a space in it. Is there a way to alter the code to account for that? I don't have the option of changing the folder name. -- GD "Ed Robichaud" wrote: Access can only have one database open at a time, though you can be linked simultaneously to many data files. You can however program a command button to open another instance of Access to show your other database. You can use the command button wizard to generate code similar to below: Private Sub btnOtherDB_Click() On Error GoTo Err_btnOtherDB_Click Dim stAppName As String stAppName = "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE FullPathName\MyApp.mdb" Call Shell(stAppName, 1) Exit_btnOtherDB_Click: Exit Sub Err_btnOtherDB_Click: MsgBox Err.Description Resume Exit_btnOtherDB_Click End Sub -Ed "GD" wrote in message ... I have a command button on a form that opens another form within the same database. Is it possible to have one that opens a separate database? Right now my code for the former is: Private Sub GoToCMLabels_Click() DoCmd.OpenForm "frmCMLabelsDataEntry", acNormal, "", "", , acNormal DoCmd.Close acForm, "frmCMDMSearch" End Sub If possible, what would the code look like to open a separate DB? -- GD |
Thread Tools | |
Display Modes | |
|
|