473,396 Members | 1,775 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.

Using combo box to control query / filter results

I am trying to use a combo box (named GTLT or "greater than less than") to sort my results based on if the Formula Weight ([FW]) is greater than or less than the PointValue given in another text box.

It seems that I am having some trouble using an iif statement here, because it will not let me change the query criteria based on if the GTLT = "greater than" or not. Here is what I have written :

IIf([Forms]![Search Type]![GTLT]="greater than",([CompoundID]![FW]>=[Forms]![Search Type]![PointValue]),([CompoundID]![FW]<[Forms]![Search Type]![PointValue]))

All I want it to do, is take the value given by PointValue, and return all results that are either greater than it (if the statement is true), or less than it (if the statement is false). Access does not seem to like this. Please let me know if you have any ideas.
Jun 11 '13 #1
3 1550
Rabbit
12,516 Expert Mod 8TB
Please show us the full SQL.
Jun 11 '13 #2
This is what MS Access gave me in SQL View for the query in question:

Expand|Select|Wrap|Line Numbers
  1. SELECT CompoundID.CpdID, CompoundID.sortas, CompoundID.CAS, CompoundID.type, CompoundID.FW, CompoundID.BP
  2. FROM CompoundID
  3. WHERE (((CompoundID.FW)=IIf([Forms]![Search Type]![GTLT]="greater than",([CompoundID]![FW]>[Forms]![Search Type]![PointValue]),([CompoundID]![FW]<[Forms]![Search Type]![PointValue]))));

Tom
Jun 11 '13 #3
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

It makes no sense to see if FW is equal to true/false. Which is what your IIf function returns. Just have it return the trues.
Jun 11 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bert | last post by:
Sorry for the unclear subject line. I've got to write a download script for and existing file manager (we are working on a complete redesign for this file manager, but the functionality of...
1
by: Cillies | last post by:
Hi! I have a form that displays information using DLookUp. Now at present I am going into the query and entering criteria that I want the form to display. i.e. the form is for a sports team and...
1
by: Cillies | last post by:
Does any one know if it is possible to search a database by using combo boxes from a form. I have a form which includes comboboxes. I want to know If I can use these combo boxes to search, i.e....
0
by: SalimShahzad | last post by:
dear gurus, I have one problem. i have listed some cities say london, tokyo, newyork,ALL. now based on the combo selection after update. it pass the value to a report query and results comes of...
3
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a...
0
by: aaryan | last post by:
hi guys, i have got a problem while trying to use databoundcombo in my application. i have got 2 ado controls each connected to two separate tables (linked by a common column). the problem is the...
5
by: PLCJockey | last post by:
I've reviewed all the code on this site but I can't get ALL in my combo box. It keeps telling me that the number of columns in the query does not match etc. Basically, I have a table where a...
6
by: Peter Herath | last post by:
I want to create a dynamic report using a crosstab query...... pls someone look into my attached example database and help me out to do the report generation.... example is like dis...: there...
1
by: didihynes | last post by:
Hi Guys, I'm in desparate need of help. I am producing a database for my dissertation and have got majorly stuck. I am currently creating a form in which the user will select a student from a...
5
dsatino
by: dsatino | last post by:
I have an Access query whose results are filtered by a custom VBA function. This works perfectly as long as the function returns a result. If the function doesn't return a result, neither does the...
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...
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
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
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.