From: divventknaa on 25 Jul 2010 15:53 I have an option group which opens a report dependent on the use of select case within the option Group. Occasionally there will be a report where the function being queried will have no issues associated with it therefore the on No Data will be true. I have tried several methods, including the OnNoData event in the report, display a msgbox saying no data, and then returning to the main form for a different selection. I have tried setting DoCmd.SetWarnings False, but cannot get rid of the error message, (2501) so the programme is halting. I saw one method using a public function but not sure how to call it. That would be the bbest way I presume, as you could set up the Public Sub and then just put the call function in every report with a generic message such as "No Data In Currently Selected Report" The Report is called "AllDeficienciesReport" Thanks JBN -- --------------------------------- --- -- - Posted with NewsLeecher v3.9 Final Web @ http://www.newsleecher.com/?usenet ------------------- ----- ---- -- -
From: Salad on 25 Jul 2010 16:14 divventknaa wrote: > I have an option group which opens a report dependent on the use of select case within the option > Group. > > Occasionally there will be a report where the function being queried will have no issues associated > with it therefore the on No Data will be true. > > I have tried several methods, including the OnNoData event in the report, display a msgbox saying > no data, and then returning to the main form for a different selection. > > I have tried setting DoCmd.SetWarnings False, but cannot get rid of the error message, (2501) so > the programme is halting. > > I saw one method using a public function but not sure how to call it. That would be the bbest way > I presume, as you could set up the Public Sub and then just put the call function in every report > with a generic message such as "No Data In Currently Selected Report" > > The Report is called "AllDeficienciesReport" > > Thanks > > JBN > > > In the option groups event the opens the report, at the bottom of your your rountine OnError routine (I assume you have one), it can change it to look something like If err.number <> 2501 then msgbox Err.Number & " " & Err.Description Resume Exit_YourLabelName
From: divventknaa on 25 Jul 2010 17:29 Apologies if this has posted twice, Broadband is down and I am one of those singularly pathetic 3G mobile BB sticks at the moment. Can retrieve mail, cant send, can retrieve headers, sometimes posts.... very hit and miss.. The subroutine calling the report is as below. I have used the Set warnings false in the OnNoData event of the report, and tried some of the 2501 msgbox suggestions. But whatever I put in it brings the error up and highlights the "DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria" line in the VB Window. I am sure I have managed to successfully get rid of this in the past, but can only find examples where it was a subreport I was replacing with a Label, made visible on no data. Private Sub DeficiencySelect_AfterUpdate() Select Case Me.DeficiencySelect Case 1 stDocName = "AllDeficienciesReport" stLinkCriteria = "[RefinedGroup]= 'A'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria Me.exitcombut.SetFocus Case 2 stDocName = "AllDeficienciesReport" stLinkCriteria = "[RefinedGroup]= 'B'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria Case 3 stDocName = "AllDeficienciesReport" stLinkCriteria = "[RefinedGroup]= 'C'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria Case 4 stDocName = "AllDeficienciesReport" stLinkCriteria = "[RefinedGroup]= 'D'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria Case 5 stDocName = "AllDeficienciesReport" stLinkCriteria = "[RefinedGroup]= 'E'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria Case 6 stDocName = "AllDeficienciesReport" stLinkCriteria = "[RefinedGroup]= 'F'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria Case 7 stDocName = "AllDeficienciesReport" stLinkCriteria = "[RefinedGroup]= 'G'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria Case 8 stDocName = "AllDeficienciesReport" stLinkCriteria = "[RefinedGroup]= 'H'" DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria End Select End Sub -- --------------------------------- --- -- - Posted with NewsLeecher v3.9 Final Web @ http://www.newsleecher.com/?usenet ------------------- ----- ---- -- -
From: Salad on 25 Jul 2010 17:42 divventknaa wrote: > Apologies if this has posted twice, Broadband is down and I am one of those singularly pathetic 3G > mobile BB sticks at the moment. Can retrieve mail, cant send, can retrieve headers, sometimes > posts.... very hit and miss.. > > > The subroutine calling the report is as below. I have used the Set warnings false in the OnNoData > event of the report, and tried some of the 2501 msgbox suggestions. But whatever I put in it brings > the error up and highlights the "DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria" line in the > VB Window. > > I am sure I have managed to successfully get rid of this in the past, but can only find examples > where it was a subreport I was replacing with a Label, made visible on no data. > > > > > > Private Sub DeficiencySelect_AfterUpdate() > > > Select Case Me.DeficiencySelect > > > Case 1 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'A'" > DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria > Me.exitcombut.SetFocus > Case 2 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'B'" > DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria > Case 3 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'C'" > DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria > Case 4 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'D'" > DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria > Case 5 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'E'" > DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria > > Case 6 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'F'" > DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria > Case 7 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'G'" > DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria > Case 8 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'H'" > DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria > > > > End Select > > End Sub > Why don't you remove the stDocName = "AllDeficienciesReport" and the DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria lines from the Select statement as it is redundent. Copy/paste them between your current end select/end sub lines. You won't need the Me.exitcombut.SetFocus line either. Why don't you add an OnError routine to your code above. You have lots of unncecessary stuff in your code but not the necessary stuff you need to make it work.
From: David W. Fenton on 26 Jul 2010 13:10 divventknaa <imat(a)hotmail.com> wrote in news:QqWdnSXPrqg6MdHRnZ2dnUVZ7qOdnZ2d(a)giganews.com: > Select Case Me.DeficiencySelect > > > Case 1 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'A'" > DoCmd.OpenReport stDocName, acPreview, , > stLinkCriteria Me.exitcombut.SetFocus > Case 2 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'B'" > DoCmd.OpenReport stDocName, acPreview, , > stLinkCriteria > Case 3 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'C'" > DoCmd.OpenReport stDocName, acPreview, , > stLinkCriteria > Case 4 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'D'" > DoCmd.OpenReport stDocName, acPreview, , > stLinkCriteria > Case 5 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'E'" > DoCmd.OpenReport stDocName, acPreview, , > stLinkCriteria > > Case 6 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'F'" > DoCmd.OpenReport stDocName, acPreview, , > stLinkCriteria > Case 7 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'G'" > DoCmd.OpenReport stDocName, acPreview, , > stLinkCriteria > Case 8 > stDocName = "AllDeficienciesReport" > stLinkCriteria = "[RefinedGroup]= 'H'" > DoCmd.OpenReport stDocName, acPreview, , > stLinkCriteria > > > > End Select Why not set your option values to the Asc() code of the letter needed? "A" is 65, so is you set the first one to 65, the second to 66, the third to 67, etc., you could pass: DoCmd.OpenReport "AllDeficiencieesReport", acPreview, , _ "[RefinedGroup]= '" & Chr(Me!DeficiencySelect) & "'" ....and entirely eliminate the select case. -- David W. Fenton http://www.dfenton.com/ contact via website only http://www.dfenton.com/DFA/
|
Pages: 1 Prev: MSGraph.Chart.8 Object Model? Next: Generic Routine For On no Data and removing error messages |