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 ?
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 ?