Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I open up another database from within Access?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a bunch of small MS Access databases (all related).

I do not want to combine them into one hugh database and so I keep them separate.

I often have to go from one to another. I was thinking how nice it would be if I could create a new database with nothing but a switchboard that would allow me to select the database I wanted, use it, then return to the switch board to select another.

First is this possible? If so, how?

Thank you.
 
You could probably code for it using the shell function, but another idea would be to link the tables in the databases you want into a central location. That's what I've done for my uses in having all the data centrally located.
 
Vidar 13,

Actually the databases were created to "read" a central database and so all of the tables are already linked.

When I combined all of the forms and reports I go from small less than 1mb program to over 15 mb. I make these program available to other techs, but not everyone is interested in them all, it was decided to break them down into smaller one function databases.

So, you mentioned "shell" and I do not know what that means, could you elaborate just a little.

Thank you, again.
 
Allow me to shed some light, you will have to alter the code a little to allow for multiple databases though.

'This button is programmed to read from the combo box on the form
'in accordnance with the variables listed.

Dim strAccDB As String
Dim strAccLoc As String
Dim strAccMtr As String
Dim intResponse As Integer

DoCmd.Hourglass False
If cboDatabase = "Agent - Month End" Then
'The "Yes/No" is a trigger for "If/Then" statements
intResponse = MsgBox("Are you sure you wish to enter the Month End database?", _
vbYesNo + vbQuestion, "Database Entry")
If intResponse = vbNo Then
With cboDatabase
.SetFocus
End With
Else

'Specify path of database listed
strAccDB = """" & "PATH" & """"

'Specify path to access.exe
strAccLoc = SysCmd(acSysCmdAccessDir) & "msaccess.exe"

'States to open new database window and to open specified file
Call Shell(strAccLoc & " " & strAccDB)

End If
'Go to the next possible selection
Else
If cboDatabase = "Tracker" Then
intResponse = MsgBox("Are you sure you wish to enter the database?", _
vbYesNo + vbQuestion, "Database Entry")
If intResponse = vbNo Then
With cboDatabase
.SetFocus
End With
Else
strAccDB = """" & "PATH" & """"
strAccLoc = SysCmd(acSysCmdAccessDir) & "msaccess.exe"
Call Shell(strAccLoc & " " & strAccDB)
End If
End If
End If

This reads from a combo box that gets the information from a table. You can use various IF/Then statements, although I'm sure there is a much shorter way to alter the variable with the pathname, such as including both in a table for your code to read.

Hope this helps!

Jay[3eyes]
 
Also, you don't need to declare the strAccMtr or place the hourglass function in there. I did those to enable a visual for the employees to remeber that they have multiple Access sessions open.

Jay [3eyes]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top