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

Query to select just one product or all products

TD
I have this expression in the criteria section of a query:

IIf(Forms!frmReports!cboProductID="<ALL PRODUCTS>",[tblProducts].[ID]
Like "*",Forms!frmReports!cboProductID)

(the syntax of the above expression may not be exact because I'm trying
to write it from memory us now)

I have a form with a combo box that I fill from a Union query that adds
the phrase "<ALL PRODUCTS>" so that when you click on this combo box
the first item in the list is "<ALL PRODUCTS>".

On the After Update event of this combo box I run a report based on
another query that has, as one of it's parameters, the item selected in
the combobox. The expression above is suppost to return all products
if the user selected "<ALL PRODUCTS>".

The espression above does not produce any errors but the query returns
no records no matter what the user selects. If I replace the expression
above with an actual product ID in the criteria section of the query
then the query it runs correctly.

Any ideas as to what I need to do to fix this?

Thanks,
TD

Nov 13 '05 #1
2 1896
Sure, just change the record source for the combo box ...
Forms!frmReports!cboProductID

to this ...

SELECT '' As ProductID, '<All Products>' AS ProductName From Msysobjects
UNION SELECT ProductID, ProductName FROM tblProducts
Order By ProductName
Now, the bound column will return empty string for "all products"
--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast/

"TD" <dl**@adsi-sc.com> wrote ...
I have this expression in the criteria section of a query:

IIf(Forms!frmReports!cboProductID="<ALL PRODUCTS>",[tblProducts].[ID]
Like "*",Forms!frmReports!cboProductID)

(the syntax of the above expression may not be exact because I'm trying
to write it from memory us now)

I have a form with a combo box that I fill from a Union query that adds
the phrase "<ALL PRODUCTS>" so that when you click on this combo box
the first item in the list is "<ALL PRODUCTS>".

On the After Update event of this combo box I run a report based on
another query that has, as one of it's parameters, the item selected in
the combobox. The expression above is suppost to return all products
if the user selected "<ALL PRODUCTS>".

The espression above does not produce any errors but the query returns
no records no matter what the user selects. If I replace the expression
above with an actual product ID in the criteria section of the query
then the query it runs correctly.

Any ideas as to what I need to do to fix this?

Thanks,
TD

Nov 13 '05 #2
TD
Thanks for all the efforts to help but I stumbled onto this solution
which works perfectly!

LIKE IIf(Forms!frmReports!cboProductID="<ALL
PRODUCTS>",[tblProducts].[ID] =
"*",Forms!frmReports!cboProductID)

Nov 13 '05 #3

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

Similar topics

9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
22
by: Robert Brown | last post by:
suppose I have the following table: CREATE TABLE (int level, color varchar, length int, width int, height int) It has the following rows 1, "RED", 8, 10, 12 2, NULL, NULL, NULL, 20...
4
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table...
5
by: green fox | last post by:
In a query, a category has a number of products identified by numbers, i.e. 240, 300, 560 etc. Each of these products can have any number of items each with its own value. I need the sum of various...
9
by: spinard | last post by:
Hi, how are you guys?? Here's my problem: I have two columns in my database : Products and Componants. A product is actually built from many componants. The data is showed like this : Products...
2
by: Alan | last post by:
I'm having a bit of difficulty getting the results I need from our database. In a nutshell I'm trying to work out trends in what people buy next. So, for example, I'm trying to run a query that...
1
by: smilesinblues | last post by:
Hi, I have these 3 tables in my DB. 1. tbl.Member a. name b. email c. username(pri key) ...and other stuff 2. tbl.Product
1
by: uspensky | last post by:
kind of a tough one i think but any help is appreciated. please try to stay away from T-SQL... I have a table with products and closing dates for each of 4 quarters and annual for several years...
2
by: bikefixxer | last post by:
Alright, I've been trying to figure this out for over an hour now and have been searching all over google but can't find anything, so I'm hoping someone here can help me out. First, a description of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...

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.