473,796 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text box showing error on report

My report is based on a query with user input [Enter year]. In my report I
have a text box with the following code: =[Enter year]. This works when the
query outcome is 1 or more records. But when the query output is zero
records this field shows #Error while I would like this text box to still
show the year the user entered. The user input doesn't seem to be available
when there is no query outcome.
Anyone an idea to make this possible?
thanks,
john
Sep 24 '06 #1
2 3095
On Sun, 24 Sep 2006 07:34:58 +0200, john wrote:
My report is based on a query with user input [Enter year]. In my report I
have a text box with the following code: =[Enter year]. This works when the
query outcome is 1 or more records. But when the query output is zero
records this field shows #Error while I would like this text box to still
show the year the user entered. The user input doesn't seem to be available
when there is no query outcome.
Anyone an idea to make this possible?
thanks,
john
Use an unbound form instead of the query [enter year] prompt, to enter
the query parameter. As long as the form is open, the report, even
with no data, will read the form control.
Here's how.

Create an unbound form.

Also add an unbound text control.
Name this control 'txtYear'.

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

As criteria in the query field write:
forms!Paramform !txtYear

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

As control source of that control in the report where you wish to
display the entered year parameter, write:
= forms!Paramform !txtYear

When ready to run the report, open the report.
The form will open and wait the entry of the wanted year.
Click the command button and then report will run.
When the report closes, it will close the form.

The year entered in the form control will display in the report, data
or no data.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Sep 24 '06 #2
"fredg" <fg******@examp le.invalidschre ef in bericht
news:1l******** *************** ******@40tude.n et...
On Sun, 24 Sep 2006 07:34:58 +0200, john wrote:
>My report is based on a query with user input [Enter year]. In my report
I
have a text box with the following code: =[Enter year]. This works when
the
query outcome is 1 or more records. But when the query output is zero
records this field shows #Error while I would like this text box to still
show the year the user entered. The user input doesn't seem to be
available
when there is no query outcome.
Anyone an idea to make this possible?
thanks,
john

Use an unbound form instead of the query [enter year] prompt, to enter
the query parameter. As long as the form is open, the report, even
with no data, will read the form control.
Here's how.

Create an unbound form.

Also add an unbound text control.
Name this control 'txtYear'.

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

As criteria in the query field write:
forms!Paramform !txtYear

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

As control source of that control in the report where you wish to
display the entered year parameter, write:
= forms!Paramform !txtYear

When ready to run the report, open the report.
The form will open and wait the entry of the wanted year.
Click the command button and then report will run.
When the report closes, it will close the form.

The year entered in the form control will display in the report, data
or no data.
Thanks! That helps.
john

Sep 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2903
by: RC | last post by:
I can't quite grasp the concept of creating custom reports depending upon what options a user picks on a Form. For example, the user clicks on a "Print Reports" button and a Form pops up. On the Form the user can choose to get a report that shows the Box Numbers that are at Warehouse A, Warehouse B or Warehouse C. and then click on the Print Preview button and get a report showing only the Box Numbers in whichever warehouse was...
2
3309
by: Hers2keep | last post by:
I have a report that prints daily. The report needs to print whether or not there are records available. I read in an old post on this group that putting an unbound text box in the report footer, with the following code in the OnNoData event would work like a charm -- Private Sub Report_NoData(Cancel As Integer) Dim NoInboundLoads As TextBox Me!NoInboundLoads = "No inbound loads scheduled for today." Cancel = False End Sub
1
6892
by: pemigh | last post by:
I have a report with pages breaking in the middle of text box controls. And it's not just on a line-by-line basis, but sometimes (in a situation that I can no longer recreate) just the bottom portions of a line's letters were showing up at the top of a page. My experiments show that Access will ordinarily break before a text box if the whole thing won't fit, but I haven't been able to find a property that will control this behavior. I...
8
3695
by: michele | last post by:
Hi, i have in my crystal report viewer .net a multiline field. When i preview the report, the text in the field is clipped on the right, so some words are invisible... i'm going mad; i've searched on the crystal decision site but without success. Please help me, thanks Michele
4
1932
by: Wayne | last post by:
I have posted this problem a couple of times over the last few years but have been unable to find a solution that works. Sometimes charts in reports will display showing the design data instead of the actual query data the first time they are opened. If the report is closed and reopened the correct data is shown. This seems to be a nasty Access bug that has carried across the last few versions at least. One post that I saw on the...
0
1870
by: Sridhar | last post by:
Hi, I have a Crystal Report which has two sub reports in it. When I try to view this Crystal Report in my local computer, it is showing data for sub reports also. But when I deploy it to the web server and view the Crystal Report I am not able to view the data of sub reports. It is not giving any error. It is not showing the data. I checked the dlls of Crystal Report. Both the local host and server has same versions. I am not knowing...
10
3924
Cyberdyne
by: Cyberdyne | last post by:
Here is the problem, I have a form with a field named Occurence with a Short Date Value, once entered it subsequently appears in 3 fields SOL1 which adds one year, SOL2 which adds 2 years and SOL6M which adds 6 month to the date entered in the Occurence field, this is done with the following Controls: =DateAdd("yyyy",1,) =DateAdd("yyyy",2,) =DateAdd("m",6,) The problem is that the data in the SOL1, SOL2, and SOL6M does not show up...
13
2901
by: penjddj1 | last post by:
(Please forgive any misuse of terms in my description as this is my first post.) I have created a text box (in a report) that is used to find a percentage based on two other controls. The calculation works fine unless there is a null value in both of the other controls. I would like to find a way to return either a 0 or bit of text (such as "N/A") whenever this situation arises. Currently, I receive the #Num! error. I have seen posts...
1
1808
by: eogyamfi | last post by:
i have subreport within the main report. The grand total for the main report is showing on the report. The grandtotal for the subreport is not showing even though on the subreport itself it shows when it is run. Pls guide as to how to get the grand total of the subreport showing as part of the main report
0
9685
marktang
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...
1
10201
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,...
0
10021
tracyyun
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...
0
9061
agi2029
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...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5454
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...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.