473,473 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help with Complex Query By Form

Hello Everyone

Access 2000

Looking for some suggestions and advice on how to proceed with this. I hope
its not as complicated as it seems to me right now.

I've got an unbound main form with a subform bound to a query
[qrySearchResults]. What I'd like to do is have the user choose criteria
from four objects on the main form then click a button that displays the
filtered results on the subform.

What I have so far on the main form going from left to right is this:

[lstboxdept] an unbound list box of departments. when the user selects a
department, the next list box [lstmajor] displays the majors associated with
those departments. This works fine.

then an unbound option [opthonors] group with a yes and no button

then another unbound list box of states [lststate].

What makes this more complicated is the fact that the user may only want to
filter on state, or honor and state, or just department and major, etc.

How do I pass the criteria from the four unbound objects to the subform's
query? Should I put the code in the onclick event of the button on the main
form or does the code go in the query grid?

Thank you for any and all help with this. I feel like I'm in over my head
on this one!

William
Nov 12 '05 #1
2 4141
You might try using Filter by Form instead of using a query. This is like
Query by Form without the query.

Con Giacomini

"William Wisnieski" <wi***************@verizon.net> wrote in message
news:Dy****************@nwrdny01.gnilink.net...
Hello Everyone

Access 2000

Looking for some suggestions and advice on how to proceed with this. I hope its not as complicated as it seems to me right now.

I've got an unbound main form with a subform bound to a query
[qrySearchResults]. What I'd like to do is have the user choose criteria
from four objects on the main form then click a button that displays the
filtered results on the subform.

What I have so far on the main form going from left to right is this:

[lstboxdept] an unbound list box of departments. when the user selects a
department, the next list box [lstmajor] displays the majors associated with those departments. This works fine.

then an unbound option [opthonors] group with a yes and no button

then another unbound list box of states [lststate].

What makes this more complicated is the fact that the user may only want to filter on state, or honor and state, or just department and major, etc.

How do I pass the criteria from the four unbound objects to the subform's
query? Should I put the code in the onclick event of the button on the main form or does the code go in the query grid?

Thank you for any and all help with this. I feel like I'm in over my head on this one!

William

Nov 12 '05 #2
Determine which controls have items selected or whatever. In the case
of a listbox, check the ItemsSelected.Count property. Then build your
query on the fly - just stuff it into a string variable. Then assign
the recordsource for the subform to that sql statement.
Nov 12 '05 #3

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

Similar topics

14
by:  | last post by:
having a spot of trouble writing this one. if you are so inclined and have a moment, i'd really appreciate your insight. i have what amounts to a purchase order type of setup...a descriptive...
6
by: EJC | last post by:
Hi Folks, I've been trying to build a query from a form of dialogue boxes I have created that holds search criteria for my main database. I have been able to get the query to retrieve the data...
4
by: Mark | last post by:
the Following bit of code doesn't work. It seems to respond to the second, starting with 'add iif statement for Good Practice', but not to the first, starting 'add iif statement for archived' ...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
1
by: Melissa Kay Beeline | last post by:
OK, here's the sitch : we have an access control system at work that registers ever entry/exit of every employee. I recently made some queries in Access so the ppl in HR could make reports (who...
3
by: dd_bdlm | last post by:
Please help this one is driving me mad! I have searched and read all the topics on the error message I am receiving but none seem to apply to me! I have quite a complex query linking all parts...
8
by: pamelafluente | last post by:
I am beginning aspNet, I know well win apps. Need a simple and schematic code example to start work. This is what I need to accomplish: ---------------------- Given button and a TextBox on a...
8
by: babyangel43 | last post by:
Hello, I have a query set up in Access. I run it monthly, changing "date of test". I would like this query to be merged with a Word document so that the cover letter is created in Word, the fields...
1
by: Randy Volkart | last post by:
I'm trying to fix a glitch in a complex access database, and have a fairly complex problem... unless there's some obscure easy fix I don't know being fairly new with Access. Basically, the area...
0
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,...
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...
1
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.