473,396 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 3061
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******@example.invalidschreef in bericht
news:1l*****************************@40tude.net...
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
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...
2
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,...
1
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...
8
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...
4
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...
0
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...
10
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...
13
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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...
0
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...
0
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,...

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.