A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Is Null in a Report



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old April 26th, 2010, 06:48 PM posted to microsoft.public.access.reports
Tim
external usenet poster
 
Posts: 780
Default Is Null in a Report

I'm using a list box to open a report for a specific record. I'm using a
report query for the report. The data in the list box updates the query. It
work fine except I would like to add some error handling before the report is
loaded. I would like to check to see if there is any data, if it is "null"
or no data provide a message box and exit before the report is loaded. I
cant seam to get pasted the if statement to check for the null. There must
be an easier way to get this accomplished. Any help would be appreciated.

Private Sub List14_AfterUpdate()
On Error GoTo Err_List14_Click

Dim stDocName As String
Dim stDocName2 As String
Dim stLinkCriteria As String
Dim stErrSiteNull As String

stDocName = "rptRebandingEquipFreq"
stDocName2 = "qryRebandingEquipFreq"
stErrSiteNull = "No Feeder System Set Yet, Try again Later!"
'open report Query and verify that there is data, if null close
query, message box and exit
DoCmd.OpenQuery stDocName2, acViewNormal
If IsNull(rs.Fields("SiteNum")) Then
DoCmd.Close
MsgBox stErrSiteNull, vbOKOnly, "Dude!"
GoTo Exit_List14_Click
Else
'If the query is not null close query and open report
DoCmd.Close
DoCmd.OpenReport stDocName, acViewPreview
End If

Exit_List14_Click:
Exit Sub

Err_List14_Click:
MsgBox Err.Description
Resume Exit_List14_Click

End Sub


 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.