473,420 Members | 1,603 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,420 software developers and data experts.

Using a form (with a combo box) to enter report criteria

I am trying to set up an unbound form to enter report criteria.

I've followed the MS Office Assistance document: "Create a form to
enter report criteria" which describes how to enter data (such as
dates) in a text box. This procedure works fine. However, I also need
to enter data from a combo box and I cannot get this to work. On my
form I've created an unbound combo box named "Name". In the query bound
to the report I've entered the criterion:

[Forms]![Name of unbound form]![Name]

However, this value does not seem to pass to the query and the report.

If I run the query by itself and enter the criteria (date and name) in
Parameter Values dialog boxes, it works.
Thanks for any help you can offer.

Nov 13 '05 #1
3 11044
On 2 Jan 2005 16:09:53 -0800, pe*******@physics.brown.edu wrote:
I am trying to set up an unbound form to enter report criteria.

I've followed the MS Office Assistance document: "Create a form to
enter report criteria" which describes how to enter data (such as
dates) in a text box. This procedure works fine. However, I also need
to enter data from a combo box and I cannot get this to work. On my
form I've created an unbound combo box named "Name". In the query bound
to the report I've entered the criterion:

[Forms]![Name of unbound form]![Name]

However, this value does not seem to pass to the query and the report.

If I run the query by itself and enter the criteria (date and name) in
Parameter Values dialog boxes, it works.
Thanks for any help you can offer.

The below combo box uses a CompanyID field to pass the criteria.
You'll need to adapt it to match your query criteria field names AND
DATATYPE.

Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set the Column Width property to 0";1"

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

Me.Visible = False

Name this form 'ParamForm'.

In the Report's Record Source [CompanyID] field criteria line write:
forms!ParamForm!FindCompany

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

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

When ready to run the report, open the report.
The form will open and wait for the selection of the Company.
Click the command button and then report will run.
When the report closes, it will close the form.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2
On 2 Jan 2005 16:09:53 -0800, pe*******@physics.brown.edu wrote:
I am trying to set up an unbound form to enter report criteria.

I've followed the MS Office Assistance document: "Create a form to
enter report criteria" which describes how to enter data (such as
dates) in a text box. This procedure works fine. However, I also need
to enter data from a combo box and I cannot get this to work. On my
form I've created an unbound combo box named "Name". In the query bound
to the report I've entered the criterion:

[Forms]![Name of unbound form]![Name]

However, this value does not seem to pass to the query and the report.

If I run the query by itself and enter the criteria (date and name) in
Parameter Values dialog boxes, it works.
Thanks for any help you can offer.


I meant to add, in my previous post that "Name" is a reserved word in
Access/VBA and should not be used as a field or control name.

See the Microsoft KnowledgeBase article for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3
Thanks very much for your help, Fred. That did the trick. The mistake I
made was in putting the criteria line:

forms!ParamForm!FindCompany (using your example)
under Company Name, rather than the bound field, Company ID.

Nov 13 '05 #4

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

Similar topics

3
by: amywolfie | last post by:
Hi All: I would like to run a report based on criteria from 3 unbound combo boxes located on a parameter form (combo boxes are: cboCuisine, cboLocation, and cboRestaurant) The present code...
9
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
3
by: Afton | last post by:
I would like to make a form that filters a report by Supervisor and by starting and ending date. I have the supervisors in a combo box, and that works. However, I do not know how to code to let...
8
by: | last post by:
hi, i have a form on which a user can choose specific criteria such as dates etc, in order to filter the report that is called from the form. i do this by using the Where section of the...
2
by: Mark Roughton | last post by:
I have a form where the users need to view records for various criteria, one of which is a date field on which they may wish to view all related data for the selected date, for all dates upto and...
3
by: mukeshhtrivedi | last post by:
Hi Gurus, I have created simple query as SELECT QUOTES.DATE, QUOTES.QUOTENO, QUOTES.SALESREP, QuoteItem.ITEM, QUOTES., QUOTES.CUSTOMER, QUOTES.AMOUNT, QUOTES., QUOTES.DivisionID,...
6
by: fieldja | last post by:
I have a form called OwnerForm. It contains a combo box called Owner. The combo box looks up names from a table called OwnerName. It contains fields called OwnerID and Owner. I also have a main...
2
by: eimbert | last post by:
I have designed a report named report by Recruiter. I have made a form called frmRecruitmentReports, on this form I have created a pair of combo boxes . 1.Beggining Date (both are unbound)...
1
by: Kevin Welch | last post by:
Looking for some expert help here. Caveat: I do not know SQL, and I've built a database basically by trial and error (unfortunately, I don't have much time to learn Access as I would want). ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
1
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
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...
0
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...

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.