Run report on Open Database (1 Viewer)

odun

Registered User.
Local time
Today, 01:47
Joined
Apr 24, 2005
Messages
108
Hello all,

Please help with this:

On opening my database, I have a switchboard that opens up.

How do also run a report automatically just after the switchboard screen opens. To make the switchboard open when I click on my database, I went to tools..> startup. But I don't know how to run a report automatically after that.

Thanks for your help!
 

llkhoutx

Registered User.
Local time
Today, 03:47
Joined
Feb 26, 2001
Messages
4,018
Open the report on the Switchboard's OnOpen event, that is,

docmd.openreport "YourReportName"
 

odun

Registered User.
Local time
Today, 01:47
Joined
Apr 24, 2005
Messages
108
Thanks much. I used the AcViewPreview and it worked, but the report stay in the background, I would like to bring it to the front. I checked a few posts, but nothing is working yet. here is my code :


Private Sub Form_Open(Cancel As Integer)
' Minimize the database window and initialize the form.

' Move to the switchboard page that is marked as the default.
Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
Me.FilterOn = True
DoCmd.Maximize
DoCmd.OpenReport "Exp", acViewPreview
DoCmd.SelectObject acReport, "Exp"
 
Last edited:

llkhoutx

Registered User.
Local time
Today, 03:47
Joined
Feb 26, 2001
Messages
4,018
After you open the report in preview mode, set focus to it, e.g.

Reports!Exp.setfocus
 

Users who are viewing this thread

Top Bottom