Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Query Form Help Complex SQL
Hussein 

14 years ago
Good day to you all,

I wish to be helped out. I have a query which takes an input from a form (let's say it is called "Form1") and there is one field in that query which is called "TotalCost". I need to filter that query based on a Min and Max "TotalCost " in order to see the items which have Total Costs between the Min & Max value. Now the point is that the same query takes another input from "Form1" and sometimes i need to filter the query based on the "City" and sometimes based on the "TotalCost" and I need to have the freedom to filter based either one of them or both so that if i choose to filter based on certain "cities" I can see all "TotalCost" related to them and vice versa and in case i need to see certain "cities" with certain "TotalCost" still I can do so. If I use { Like "*" & } tool then it will not work with the "TotalCost" field because it will show all the records which contain that digits I put in "Form1" input! So how to go around this situation?
I hope i made my self as clear as possible and sorry for the lengthy message.
Appreciate your valuable feedback


Reply from Richard Rost:

This sounds like a pretty complex form/query combination. Your BEST bet is to probably build yourself a dynamic SQL statement to feed your form, like I show in my SQL Seminar. With many variables like this, a simple query might become too complex to work with easily.

For example, filtering by total cost is no problem. You just put a criteria in your date field that says:

BETWEEN Forms!MyForm!CostMin AND Forms!MyForm!CostMax

But now when you start adding cities and such in there, you're going to be getting into multi-row criteria, NULL situations, and such. Better to just build a query like this in SQL.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/17/2026 7:08:54 AM. PLT: 1s