Hi
I currently have the following code attached to a command button on a switchboard form. This is basic Access 2000. - Private Sub Print_daily_reports_button_Click()
-
-
On Error GoTo NoData
-
-
DoCmd.OpenReport "Sales Return (TODAY)", acViewNormal
-
DoCmd.OpenReport "Sales/Collections (TODAY)", acViewNormal
-
DoCmd.OpenReport "SRV Register (TODAY)", acViewNormal
-
DoCmd.OpenReport "STPC Voucher Register (TODAY)", acViewNormal
-
DoCmd.OpenReport "FIMs issued (today)", acViewNormal
-
-
NoData:
-
-
If Err.Number = 2501 Then
-
Resume Next
-
End If
-
-
End Sub
For the first 2 reports, I have another report that will just print a separate report when there are no items to report. I am trying to work out the code needed.
I have tried setting on the report's NoData event to print the other report but the macro stops. Is there a way to refer to the NoData event in the code builder as above?
Prior to the above code builder I have also tried a macro to print all the same reports with a separate macro in the sales return report on the nodata event but that comes with the error "The function Open Report is not available now".
Any ideas will be greatly appreciated.
Thanks
2 2852 nico5038 3,080
Recognized Expert Specialist
You should check the report's query to return records before triggering the report.
One way is to use a recordset for this, but as I guess you only need to check a specific date, the DLOOKUP() could be an alternative like: -
IF IsNull(DLOOKUP("datefieldname","tablename","datefield=Date()")) then
-
-
else
-
-
endif
-
Dlookup() will return Null when nothing is found.
Clear ?
Nic;o)
ADezii 8,834
Recognized Expert Expert
Hi
I currently have the following code attached to a command button on a switchboard form. This is basic Access 2000.
Private Sub Print_daily_rep orts_button_Cli ck()
On Error GoTo NoData
DoCmd.OpenRepor t "Sales Return (TODAY)", acViewNormal
DoCmd.OpenRepor t "Sales/Collections (TODAY)", acViewNormal
DoCmd.OpenRepor t "SRV Register (TODAY)", acViewNormal
DoCmd.OpenRepor t "STPC Voucher Register (TODAY)", acViewNormal
DoCmd.OpenRepor t "FIMs issued (today)", acViewNormal
NoData:
If Err.Number = 2501 Then
Resume Next
End If
End Sub
For the first 2 reports, I have another report that will just print a separate report when there are no items to report. I am trying to work out the code needed.
I have tried setting on the report's NoData event to print the other report but the macro stops. Is there a way to refer to the NoData event in the code builder as above?
Prior to the above code builder I have also tried a macro to print all the same reports with a separate macro in the sales return report on the nodata event but that comes with the error "The function Open Report is not available now".
Any ideas will be greatly appreciated.
Thanks
Nico has the right idea, just substitute you own Parameters: - Private Sub Print_daily_reports_button_Click()
-
On Error GoTo NoData
-
-
If IsNull(DLookup("datefieldname", "tablename", "datefield=Date()")) Then
-
'Print Report for no Data
-
Else
-
DoCmd.OpenReport "Sales Return (TODAY)", acViewNormal
-
End If
-
-
If IsNull(DLookup("datefieldname", "tablename", "datefield=Date()")) Then
-
'Print Report for no Data
-
Else
-
DoCmd.OpenReport "Sales/Collections (TODAY)", acViewNormal
-
End If
-
-
DoCmd.OpenReport "SRV Register (TODAY)", acViewNormal
-
DoCmd.OpenReport "STPC Voucher Register (TODAY)", acViewNormal
-
DoCmd.OpenReport "FIMs issued (today)", acViewNormal
-
-
NoData:
-
-
If Err.Number = 2501 Then
-
Resume Next
-
End If
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Michael Dekson |
last post by:
Access 97.
I make a report and I want first to see report and then print report without
type CONTROL + P.
Can I make some button or can I see print button in toolbar meny.
Thanks
|
by: ChadDiesel |
last post by:
Hello,
I have a form and subform with their tables linked by a field called
Load_ID. I have a button on my subform that prints just the items listed on
that particular subform (looking at Load_ID). I'm using the following code:
DoCmd.OpenReport "Load Sheet", acPreview, , "= " & "'" &
Me.Parent.Form! & "'"
This works fine, but now I want to automate the process, so I set the
|
by: Joki |
last post by:
Hi,
All
Can i capture print button click event on crystalreportview control?
Thanx
Joki
|
by: Tony Dong |
last post by:
Hi there,
I am newer for dot net
I want to make a report and then print it, the report may include images and
text, how can I do that, any one can give me a suggestion?
I know how to working with printers, but it looks just support text or image
separately.
Can I use cystal report to make a report and then use dot net program to
|
by: thh108688 |
last post by:
Hi All,
Is anyone know how to do a print report based on my current record. What i would like to get is once i have entered all the value in the form, when i hit the print button, all the value will be printed in a nice word document.
It is good if someone can give me an example when explaining as i am quite new with Access. Sick of coding!
Appreciate for that!
Cheers
Ray
| |
by: felicia |
last post by:
Can anyone help me on How to use Data Report in VB and how to print report?
I hope i can generate the Data Report without Data Environment because I am not fammiliar with it. Simple adodb or adodc connection is fine for me.
|
by: Snoopy33 |
last post by:
I have a DB that I developed on access XP (2002) and deployed over a
year ago. No one has had problems printing any of the reports within
the DB until we started loading 2007 on new computers. The access
2007 users cannot print one of the reports. This is maddening since I
cannot duplicate the issue on any computer that runs 2003 or below.
Is there something going on that I'm not seeing? Does anyone have any
suggestions at all on...
|
by: Fred Zuckerman |
last post by:
Hi All,
I have a report with an accumulating value control. I use the Detail_Format
event to periodically change the backcolor of the control. The control
(Me.Tot) prints green except for the records where it reaches a multiple of
300. In the Open event I set the variable Milestone to an initial value of
300. On the initial records, Me.Tot prints with backcolor of green. When
Me.Tot reaches 300 I change the backcolor to red and reset...
|
by: abil |
last post by:
i've already build a program that contain all the price, the change given back to the customer but i dun have no idea which function i should use to do program print report...
#include <cstdlib>
#include <iostream>
#include<iomanip>
using namespace std;
const int TEH_TARIK = 0;
const int NESCAFE = 1;
const int HORLICK = 2;
const int TEH_O = 3;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |