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

open report in succession

Status
Not open for further replies.

samotek

Technical User
May 9, 2005
197
BG
In order to check for figures i want to make a function that opens and closes a report in a succcession depending on the option values chosen.Instead of clicking on the option group called Houses, i use the value of the field :
Dim stDocName As String
stDocName = "RptHouseReport"

Me!Houses.Value = 1
DoCmd.OpenReport stDocName, acPreview
DoCmd.Close acReport, "RptHouseReport"


Me!Houses.Value = 1
DoCmd.OpenReport stDocName, acPreview
DoCmd.Close acReport, "RptHouseReport"

Me!Houses.Value = 3
DoCmd.OpenReport stDocName, acPreview
DoCmd.Close acReport, "RptHouseReport"


etc... etc....

However my function stops at the first report,, it opens the report for the first option and then stops, it stays wih the report opened.What is the reason for my wrong function ?
 
samotek
I'm not exactly sure what you are hoping to accomplish here.

To begin with, regardless of the Value of Me.Houses, you are opening the exact same report. If you are wanting to look at the report when the Value of Me.Houses = 1, then you will need to add a Where clause to your DoCmd statement, so that only those instances where [Houses] = 1 will be shown.

But you want to open a report and then immediately close it?

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top