Open A forn in a .accdb file by a form in another .accdb file (1 Viewer)

Power_User

Registered User.
Local time
Today, 05:44
I have 2 Access 2007 Files ( Suppliers.accdb ) and ( Personel.accdb ) in same folder as part of a program . When program start with double click on Suppliers.accdb , automatically open form Main in this file ( this form work as Switchboard ) . I want to open form PersonelInformation that exist in file Personel.accdb , by click on a command botton in form Main .
Please Help , which way ( or what code ) I can close form Main in file Suppliers.accdb and then open form PersonelInformation in the file Personel.accdb .
 

Trevor G

Registered User.
Local time
Today, 13:44
Open your database then open the form in desgin view. Add a command button and then stop the wizard (Click Cancel). Next open the properties of the Command Button and name it something like cmdOpenAnotherDatabase, then select the Event Tab and in the On Click use the elipsee button and select Code Builder and then add this code.


Private Sub cmdOpenAnotherDatabase_Click()
DoCmd.Close 'This should close your form down
Dim obj As New Access.Application
obj.OpenCurrentDatabase ("M:\MrExcelStuff.mdb") 'Change Path and database name
obj.DoCmd.OpenForm "frmImageName" 'Change to form name
obj.Visible = True
Set obj = Nothing
End Sub
 

Users who are viewing this thread

Top Bottom