Place Database on Top

Novice1

Registered User.
Local time
Yesterday, 23:22
Joined
Mar 9, 2004
Messages
385
I have a customer working in the primary database. Should the customer acknowledge he needs to complete a particular form, another database opens (secondary db). Once the customer provides the necessary information, I want the secondary database to close and return to the primary database at the main form.

I placed the following code in an Event Procedure, on the primary database which works fine; however, the Secondary database appears behind the Primary database so it cannot be seen. I suppose I could quit the primary and open the secondary, but I would prefer to open the secondary, collect the information, then return to the main page on the primary db. Any help would be appreciated.

=================

Dim accapp As Access.Application
Dim appname As String
Set accapp = New Access.Application
appname = "\\52qseu-fs-05pv\moody_msg\fss\fss old file structure 1\alpha\MPF\MPF_Mgmt_Info_System\SGLIPrepTool\SGLIPrepTool.accdb"
appname = "M:\MPF\MPF_Mgmt_Info_System\SGLIPrepTool\SGLIPrepTool.accdb"

accapp.OpenCurrentDatabase (appname)
accapp.DoCmd.OpenForm "frmCustomerInput1"
accapp.Visible = True
 
I wouldn't open another Access.Application to accomplish this, rather, I would create an interface in the same file the user is currently using, so the process is seamless. Just link to the remote table, and copy the form you need into the current database, and you can open the form locally.
 
I understand but it's not that easy. There are several forms for the member to complete. Also, the database may be used as a stand alone program.
 
Check out windows API calls SetForegroundWindow and/or BringWindowToTop from User32. I don't know that much about these topics, but a code example follows . . .
Code:
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As IntPtr) As Long
Private accapp As Access.Application

Sub YourCode()
   set accapp = new Access.Application
   accapp.OpenCurrentDatabase "M:\MPF\MPF_Mgmt_Info_System\SGLIPrepTool\SGLIPrep Tool.accdb"
   accapp.DoCmd.OpenForm "frmCustomerInput1"
   accapp.Visible = True 
   SetForegroundWindow accapp.hWndAccessApp
End Sub
hth
 

Users who are viewing this thread

Back
Top Bottom