473,756 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11071
On 2 Jan 2005 16:09:53 -0800, pe*******@physi cs.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*******@physi cs.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
2084
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 for the FIND button (using just cboCuisine for testing) is: Private Sub Command13_Click()
9
7026
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 it return the associated records to a listbox. Once the listbox has the records, I want to select a record, which will open a form associated with the selected record in the listbox.
3
2908
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 the user enter a starting and ending date and only show the records between those dates. The code that I have so far does not work for the dates, but I'm including it anyway so you show me what to change. Thanks so much! :) Here is my code (the...
8
13528
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 docmd.openreport as follows DoCmd.OpenReport stDocName, acPreview, , strWhere where strWhere is a string dependant on the choices the user makes in the
2
5738
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 icluding the selected date or all records on or after the selected date The user selects either "=", >=" or "<=" from a combo box and then a date from another combobox. The combination of thse two choices is then set in an unbound textbox so...
3
4939
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, QUOTES.STATUS FROM QUOTES INNER JOIN QuoteItem ON QUOTES.QUOTENO = QuoteItem.QUOTENO WHERE (((QUOTES.DATE) Between And ) AND ((QUOTES.SALESREP)=) AND ((QuoteItem.ITEM)=))
6
12473
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 form called ProjectsForm. This form has several fields to enter data. I have a query that is called Owner Query. This query contains the fields IDNumber.Projects2 Team.Projects2 and Owner.OwnerName getting information from tables. On the...
2
1581
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) 2.Ending Date. A query called recruitment query The table being used is tblRecruitment the Field were criteria is initcontactdate Argument: Between .. And .. . All this works fine when I enter dates. Once I pass the date fields I'm prompted
1
3671
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). My basic database form is for patients, and I store their info in the database and link to videos of surgery, etc. I made a switchboard, a few queries, and a few reports that I can use to look at categories, etc. However, instead of run a report or...
0
9456
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...
0
9275
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,...
0
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
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 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...
1
9843
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
8713
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...
0
5142
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.