Blank Report Message

I am working with Access 2002 trying to add code to a report when it opens to 
tell the user when there aren't any records to display.  It works fine on a 
regular report, but I have a report that starts out blank, no query and no 
fields, but has two subs on it.  I needed to do this because of calculations 
done in the footer on different fields.  I have added the following code to 
the button that opens the report, rptQuestionsOneAndFive.

Private Sub Command30_Click()
On Error GoTo ErrorOpen
DoCmd.OpenReport "rptCalendar", acViewPreview

ExitOpen:
Exit Sub

ErrorOpen:
If Err = 2501 Then
    Resume ExitOpen
Else
    MsgBox Err.Description
    Resume ExitOpen
End If

End Sub

I then added the following code to both of the subreports, subrptQuestionOne 
and subrptQuestionFive:

Private Sub Report_NoData(Cancel As Integer)
On Error GoTo ErrorHandler
MsgBox "There are currently no records to display.", vbOKOnly
Cancel = True

ExitReport:
    Exit Sub
    
ErrorHandler:
    MsgBox Err.Description
    Resume ExitReport

End Sub

All I get is a blank report since the subs are on a blank report.  Is there 
a way to still have the message appear if the report still opens but is 
blank.  I'm a beginner in VB so hopefully it won't be too complex if it can 
be done.  Thanks in advance for the help.
0
Utf
2/5/2010 1:01:01 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

2 Replies
674 Views

Similar Articles

[PageSpeed] 27

I have a typo from copying from a different report that works.  The following 
line should be:

DoCmd.OpenReport "rptQuestionsOneAndFive", acViewPreview

and not

DoCmd.OpenReport "rptCalendar", acViewPreview



"Ann" wrote:

> I am working with Access 2002 trying to add code to a report when it opens to 
> tell the user when there aren't any records to display.  It works fine on a 
> regular report, but I have a report that starts out blank, no query and no 
> fields, but has two subs on it.  I needed to do this because of calculations 
> done in the footer on different fields.  I have added the following code to 
> the button that opens the report, rptQuestionsOneAndFive.
> 
> Private Sub Command30_Click()
> On Error GoTo ErrorOpen
> DoCmd.OpenReport "rptCalendar", acViewPreview
> 
> ExitOpen:
> Exit Sub
> 
> ErrorOpen:
> If Err = 2501 Then
>     Resume ExitOpen
> Else
>     MsgBox Err.Description
>     Resume ExitOpen
> End If
> 
> End Sub
> 
> I then added the following code to both of the subreports, subrptQuestionOne 
> and subrptQuestionFive:
> 
> Private Sub Report_NoData(Cancel As Integer)
> On Error GoTo ErrorHandler
> MsgBox "There are currently no records to display.", vbOKOnly
> Cancel = True
> 
> ExitReport:
>     Exit Sub
>     
> ErrorHandler:
>     MsgBox Err.Description
>     Resume ExitReport
> 
> End Sub
> 
> All I get is a blank report since the subs are on a blank report.  Is there 
> a way to still have the message appear if the report still opens but is 
> blank.  I'm a beginner in VB so hopefully it won't be too complex if it can 
> be done.  Thanks in advance for the help.
0
Utf
2/5/2010 1:04:03 PM
Thanks, but I don't need this anymore.  I got it to work by redesigning the 
report.
"Ann" wrote:

> I have a typo from copying from a different report that works.  The following 
> line should be:
> 
> DoCmd.OpenReport "rptQuestionsOneAndFive", acViewPreview
> 
> and not
> 
> DoCmd.OpenReport "rptCalendar", acViewPreview
> 
> 
> 
> "Ann" wrote:
> 
> > I am working with Access 2002 trying to add code to a report when it opens to 
> > tell the user when there aren't any records to display.  It works fine on a 
> > regular report, but I have a report that starts out blank, no query and no 
> > fields, but has two subs on it.  I needed to do this because of calculations 
> > done in the footer on different fields.  I have added the following code to 
> > the button that opens the report, rptQuestionsOneAndFive.
> > 
> > Private Sub Command30_Click()
> > On Error GoTo ErrorOpen
> > DoCmd.OpenReport "rptCalendar", acViewPreview
> > 
> > ExitOpen:
> > Exit Sub
> > 
> > ErrorOpen:
> > If Err = 2501 Then
> >     Resume ExitOpen
> > Else
> >     MsgBox Err.Description
> >     Resume ExitOpen
> > End If
> > 
> > End Sub
> > 
> > I then added the following code to both of the subreports, subrptQuestionOne 
> > and subrptQuestionFive:
> > 
> > Private Sub Report_NoData(Cancel As Integer)
> > On Error GoTo ErrorHandler
> > MsgBox "There are currently no records to display.", vbOKOnly
> > Cancel = True
> > 
> > ExitReport:
> >     Exit Sub
> >     
> > ErrorHandler:
> >     MsgBox Err.Description
> >     Resume ExitReport
> > 
> > End Sub
> > 
> > All I get is a blank report since the subs are on a blank report.  Is there 
> > a way to still have the message appear if the report still opens but is 
> > blank.  I'm a beginner in VB so hopefully it won't be too complex if it can 
> > be done.  Thanks in advance for the help.
0
Utf
2/5/2010 2:05:01 PM
Reply:

Similar Artilces:

option "send picture with messages"
Hi ... where can i find the "send picture with messages" option in MS Oulook 2007 ? in Outlook Express you can find this option send picture with messages" in Tools -> Option -> Send -> HTML Settings -> send picture with messages option .... BUT in Oulook 2007 i couldn't find it .. so canyou please where can find it .. Thank You That is a registry only option now. See http://www.msoutlook.info/question/72 -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downl...

OL2007, messages don't always close after sending
Let's say I've just finished a spreadsheet and I want to send it to someone. I'll click the big Office button and choose Send -> Email, and up pops a new email message with my spreadsheet attached. All fine so far until I click the Send button (or Alt-S, or Ctrl-Enter, doesn't matter which). The message appears in the Outbox and Outlook will send it, but it also stays open in front of Excel until I click the Close button. I can still make further edits to my workbook, but the email message is in the way and I can't see what I'm doing, until I manually close...

moving messages from outlook express to outlook
I am trying to move messages from outlook express version 6 to outlook 2003. When I export from outlook express, there is no indication where the export file is stored. Is there a way to move messages or will I have to email them to myself? Thanks ...

C00D11B3 error message
I have been using Media player for years, now have ver. 11, in the past two day, I have had a problem if I go to player and play some music stored on the hard drive, it works. I f I attempt to play something on the internet I get the error and then it won't play anything until I reboot the system. I thought it was a firewall issue, but can't figure out what it would be. I also have checked connect to the internet override, without success. I have recently changed routers to a linksys with Network Magic set to basic. I have no idea what is causing the issue. -- J P...

Stripping Blank Characters form Imported Data
I am trying to verify 2 worksheets full of data. One has been imported from Visual Basic and the other from Business Object. The Business object sheet, brings over the entire field not just the charaters needed. Example: For the city field there are 50 characters available. If you use Nashville, the Business Object brings over 50 characters where the Visual Basic brings over 9. When trying to find descrepancies, this brings back a false positive if the city is the same. Is there a way to manipulate that data when it is sent to Excel? The easiest way to deal with this would be to find...

Overrides vs. Messages
Hi I have a basic question about MFC. There are 4 sections in Properties windows -Properties -Events -Messages -Overrides For example: For CView class OnDraw is in overrides section. But OnDrawItem is in messages section. Why is it so? Some methods are in mesages section(handle with message map) some are virtual. What is the logic behind this separation? Thank you. In a nutshell, the override section give you access to the virtual function of that class, and the messages sections give you access to the messages that are not already mapped to a virtual function in that class. I hope that ...

Messages not delivered to another Routing Group HELP NEEDED
I have three routing groups ( exchange in the 3 of them are Exch 2k sp3 ). Mail from one server ( in my headquarter routing group ) to another ( in one branch office routing group ) is getting stucked in MESSAGES WITH UNREACHABLE DESTINATION and not routed to that server. Connectors seems to be working just fine. After add my other exchange server from my headqurter group to the connector to be albe to send mail it shows the queue now in the connector but does not sends anything. Otherwise, mail from my branch office to my headquarter correctly sends mail. Any help would be gre...

Formula In Crystal Reports
Hi All, I'm just starting to learn Crystal right now but it's all very new to me so I was just curious if anyone knows if you can do formulas in it. I'd like to take a custom CRM field called setup cost on a product and add all the values of this field up in a quote. Ie if there are 3 products all with seperate setup costs I want to add those together. Or will this have to be done a different way? Thanks all Tom Hi, Crystal supports both VB and Crystal Reports formulas. the help files are quite good regarding formulas, and the 9.2.2 CR with enhanced edition has an excel...

WindowProc: combobox messages problem
In my CControlBar I have overridden the virtual WindowProc. The combobox on the controlbar displays correct and behaves well in runtime. Now, I spent a couple of hours trying to get some messages that I need, using WindowProc. This is needed because CControlBar will pass everything on to the controlbar owner, and that's not what I want. WindowProc is my way to intercept those messages. I already found out that the messages are, ehm, weird: their numbers do not match on related defines in winuser.h. To give an example: WM_COMMAND, 0x0003 functions as a WM_SETFOCUS. But WM_SETFOCUS is def...

Viewing messages #2
When I get e-mail and try to view the messages, they never come up. Can someone help me? Not yet. State your Outlook version, the type of mail transport you are using, whether you are using a preview pane or opening the message, etc. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Wleef33 asked: | When I get e-mail and try to view the messages, they | never come ...

Import Messages from Outlook Express 6
Hi, I would like some advice on importing messages that are currently on a Win98se machine running OE 6 into an XP Pro machine running Outlook 2003, Thanks, any help greatly appriciated, Ed <anonymous@discussions.microsoft.com> wrote in message news:5c9c01c3e5bb$834ea400$a001280a@phx.gbl... > Hi, > I would like some advice on importing messages that are > currently on a Win98se machine running OE 6 into an XP > Pro machine running Outlook 2003, > Thanks, any help greatly appriciated, > Ed Go here to backup your old OE: http://insideoe.tomsterdam.com/backup/index.htm...

Message tracking not work on XP SP2
Message tracking is not working on Windows XP SP2. I've tried System Manager 2000 and 2003 with the same result. Message searching will started, but is still running without result. After uninstalling SP2 it's working fine! On Wed, 19 Oct 2005 05:26:05 -0700, Pol <Pol@discussions.microsoft.com> wrote: >Message tracking is not working on Windows XP SP2. I've tried System Manager >2000 and 2003 with the same result. Message searching will started, but is >still running without result. After uninstalling SP2 it's working fine! Your workstation needs to be abl...

certin messages block POP download.
Hi all, I have an Exchange 2003 server with @ 300 users with many virtual domains. Problem I have is that one domain in particular has certin messages getting stuck while downloading and have to be cleared in Webmail in order to free the mailbox. They mainly seem to be HTML messages but there have been two text ones from another Virtual Domain. I am stumped. I get no errors in the logs and have turned on diagnostics logging to watch whan it is happening and do not see anything. I have elimantated Outlook by trying Outlook Express at the same thing happens. They get sometimes as many a...

Weird black screen when responding to message
Hi All, The title says it all really. I've recently started to get a black screen with coloured type when I reply to messages. Invariably the screen goes back to white with whatever colour type is applicable to a string of messages but sometimes I have to hit send with it showing coloured text on black. When the message arrives at the other end the colour is correct. More oddly, this doesn't happen on all messages but is beginning to become more frequent. I've run a couple of spyware progs and Norton anti virus etc. so don't think its anything nasty behind it. So over to...

Sorting messages by sender
I've recently changed from using Outlook 2003 on an old Celeron PC running Win 2k, to a new P4 machine with XP. On the old set-up, I could click on the 'From' column header to sort messages in a mail folder by sender, then start typing the name of the sender to quickly take me to the messages from that person. This was very useful and I used this feature regularly, although it only seemed to work for the first three characters of the name, the fourth character entered would then take the cursor to the first instance of a name beginning with this letter. This was fine as the firs...

Multiple messages
Hi I am receiving the same messages a number of times to my outlook express mail box. Sometimes I have 5 or 6 of the same message. Does anyone know why this is, or how I can stop it? Thanks very much Try posting this in an Outlook Express news group - this is not one of them. Outlook is a part of Microsoft Office and is what this group supports. Outlook Express is a part of Internet Explorer and has its own news groups. You can also find some good Outlook Express information here: http://www.insideoutlookexpress.com/ --� Milly Staples [MVP - Outlook] Post all replies to the group...

Intelligent Message Filtering
Hi All, Just to say what a good product IMF is. All my Junk-Mail is archived in a local queue. My dream become true ! No more wasted time in explaining what a SPAM is...... Diego P Castro MCSE-MCSA-SPS8 Brasil ...

Error Message 0x8007007F
Clip organizer keeps giving this error message when opened: Error Message 0x8007007F It will not open or insert pictures!!! Would appreciate any and all help junk2bj@hotmail.com http://www.mvps.org/msauer/clip_organizer_support.htm -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.mvps.org/msauer/ news://msnews.microsoft.com "BJ" <junk2bj@hotmail.com> wrote in message news:38ec01c42980$ce5312c0$a301280a@phx.gbl... > Clip organizer keeps giving this error message when > opened: > > Error Message 0x8007007F > > It will not open or insert pictu...

Outlook does not refresh imap inbox when message is deleted on ser
I have Outlook set up to use imap on two computers as well as my Palm. The problem is that messages deleted from the server will not dissappear in Outlook as long as Outlook is running. If if restart Outlook the imap inbox is updated correctly. I thougt Microsoft had solved this problem between Outlook 2000 and 2003, but obviously not. Is there a solution? You will need to manually purge the items using Edit->Purge. (I think it is on the Edit menu - I despise IMAP so I don't have a current setup to check.) --� Milly Staples [MVP - Outlook] Post all replies to the group to keep ...

Error message #3
Hi, everyone, I open to MS Excel 97, the following error messages was shown on screen. 26146100: file format is not valid. Please help Thanks Jimmy Something that is being opened is causing trouble. It could be an addin checked in Tools|Addins or a file in your XLStart folder (or if you are using tools|options|General|"Alternate Startup File location", it could be in there.) (Not many use the alternate startup file location, so try erasing that value from that box in excel--don't delete the real folder. If that fixed it, you're done.) If not, your task will be to...

Error message 0x800ccc13 #4
Does anyone know what error message #0x800ccc13 means. I get it when I hit the sned/receive button. I can send email through Outlook 2000 but I can't receive anything. The message says that a TCP/IP error occured while trying to send data to the serever. All of my server set up info appears correct. I appreciate any answers ...

Parmeters in Reports
Hello, I have a report generated from a query. The field names are add1, add2 and add3, productname. The data in the fields: add1-add3 are the same. I would like to be prompted when I open the report for the data in fields add1, add2 and add3. Thanks -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200708/1 Open the query in design view. Add this as criteria for add1 --- [Enter add1 info] If you want the query to return records that have all if the criteria you enter then put criteria for the rest on the same criteria row. Otherwi...

Report width will not shrink
I have a report that was originally designed as legal size, but by eliminating a few columns is now landscape letter size. However I am unable to shrink the width from 12" to 9" - there seems to be something invisible to me in one of the headers, footers or detail sections. I have tried everything to try to select whatever it is that is 12" wide but am unable to find it. I have tried CTRL A for select all, tried highlighting from the top or the side, etc but nothing shows up. It has to be a line or something, but when I preview the report the second page is blank. I ...

Turn Off SOP Transfer Log Report
Is there any way to not have the SOP Transfer Log show up? We usually just hit the Cancel button on the Report Destination window but it gets annoying when you transfer 100-150 orders a day. I know you can go into the posting setup to cancel posting reports but I can't find anyway to stop the Transfer Log. -- Scott Scott, No, there isn't a method built in to do this. You'd need a customization using Dexterity or I think you could use VBA to do this as well. patrick mbs developer support -- This posting is provided "AS IS" with no warranties, and confers no ri...

Inserting rows slow on large report
I have a large report I maintain with 3 data tabs and 2 report tabs, 1 for top 10 customers, about 400 rows, and another for all other customers, about 4000 rows. Every month I have to update it for any new customer/product combinations. I have optimized the formulas to the best of my abilities and gotten a full recalc time down from 3 min to 30 sec, which is acceptable. My biggest problem now is that every time I need to add a row (or delete one for that matter) it takes about 15 seconds (on the 4k row report, adding to the top 10 customers report takes 3-5 seconds), per row....