dbTalk Databases Forums  

Was - Error Message Suppression on No Data

comp.databases.ms-access comp.databases.ms-access


Discuss Was - Error Message Suppression on No Data in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
divventknaa
 
Posts: n/a

Default Was - Error Message Suppression on No Data - 07-25-2010 , 04:29 PM






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

Reply With Quote
  #2  
Old   
John Spencer
 
Posts: n/a

Default Re: Was - Error Message Suppression on No Data - 07-26-2010 , 08:17 AM






Try changing acPreview to acViewPreview. Both should work but the standard is
the latter.

In the current sub, I would add some error handling.

Private Sub DeficiencySelect_AfterUpdate()
On Error GoTo Proc_Error

Select Case Me.DeficiencySelect
....
End Select

Exit Sub

Proc_Error:
If Err.Number = 2501 then
'Skip it
Else
MsgBox Err.Number & ": " & Err.Description
End If
End Sub



John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

divventknaa wrote:
Quote:
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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.