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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Events be used with acPreview View? 1

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
I have an Access report that opens in acPreview after a form command button is clicked. I need to somehow set a timer that runs a subroutine 5 seconds after the report is displayed on the screen. The subroutine is below. I cannot set this timer on the click event of the command button because doing so removes focus from the report and the ActiveReport argument fails.

Dim CurrentReport As Report
Set CurrentReport = Screen.ActiveReport
Msgbox "The report name is " & CurrentReport

How can I successfully run this sub 5 seconds after the report is displayed? Thanks.

--
Mike
 
use a form to open the report.
on a button on the form do the following:
Code:
Dim i as Integer
i = 0
DoCmd.OpenReport "[ReportName]",AcPreview
While i < 5000000
 i = i + 1 
Wend
i = 0
MsgBox "The report name is " & CurrentReport
DoCmd.SelectObject acReport, CurrentReport


Brought to you By Nedaineum
The Portal to Geek-tum
 
Change the 5000000 as required to get the right timing

Brought to you By Nedaineum
The Portal to Geek-tum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top