how to open another access database (1 Viewer)

nhk

Registered User.
Local time
Today, 21:21
Joined
Jul 11, 2012
Messages
19
hye all...

i want to ask is there any way to open another access database using when click button at form..
for example i have tracking.accb then at my switchboard form, i would like to have a button that can go to another access which is borrow.accb.

can these possible for me to do it..?
any help much appreciate..

thank in advance
 

JHB

Have been here a while
Local time
Today, 14:21
Joined
Jun 17, 2012
Messages
7,732
From the Help-file
Code:
The following example opens a Microsoft Access database from another  application through Automation, then opens a form in that database.
 You can enter this code in a Visual Basic module in any application  that can act as a COM component. For example, you might run the following code  from Microsoft Excel, Microsoft Visual Basic, or Microsoft Access.
 When the variable pointing to the [B]Application[/B] object goes out  of scope, the instance of Microsoft Access that it represents closes as well.  Therefore, you should declare this variable at the module level.
' Include following in Declarations section of module.
Dim appAccess As Access.Application

Sub DisplayForm()
    ' Initialize string to database path.
    Const strConPathToSamples = "C:\Program " _
        & "Files\Microsoft Office\Office\Samples\Northwind.mdb"

    strDB = strConPathToSamples & "Northwind.mdb"
    ' Create new instance of Microsoft Access.
    Set appAccess = _
        CreateObject("Access.Application")
    ' Open database in Microsoft Access window.
    appAccess.[B]OpenCurrentDatabase[/B] strConPathToSamples
    ' Open Orders form.
    appAccess.DoCmd.OpenForm "Orders"
End Sub
 

nhk

Registered User.
Local time
Today, 21:21
Joined
Jul 11, 2012
Messages
19
thank JHB for reply..

i want to ask, the access can only store in c or can also be store in thumb-drive..?

from this code
"C:\Program " _
& "Files\Microsoft Office\Office\Samples\Northwind.mdb"


thank in advance.
 

nhk

Registered User.
Local time
Today, 21:21
Joined
Jul 11, 2012
Messages
19
it's ok i already find it out..

thank JHB..your given code work great..

thank again..
 

Users who are viewing this thread

Top Bottom