Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old May 6th, 2008, 01:34 PM
Jake02 Jake02 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 58 Jake02 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 51 m 19 sec
Reputation Power: 1
Queries - Use multiple queries

I have a search menu where the user can choose a search option:

1. Search by Date Filed
2. Search by Paid Date
3. Search by Invoice No.
4. Search by Client Name

etc....

I have a query built for each of these options, 14 in all. Is there a way that I could have the user enter more than one option, and link those queries together? For example, they could enter 1 and 4 to search for Client Name on a particular filing date.

I would rather not have to write a query for each and every option...

Thanks.

Reply With Quote
  #2  
Old May 6th, 2008, 06:07 PM
don94403's Avatar
don94403 don94403 is offline
Contributing User
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jan 2007
Location: Northern California
Posts: 1,171 don94403 User rank is Captain (20000 - 30000 Reputation Level)don94403 User rank is Captain (20000 - 30000 Reputation Level)don94403 User rank is Captain (20000 - 30000 Reputation Level)don94403 User rank is Captain (20000 - 30000 Reputation Level)don94403 User rank is Captain (20000 - 30000 Reputation Level)don94403 User rank is Captain (20000 - 30000 Reputation Level)don94403 User rank is Captain (20000 - 30000 Reputation Level)don94403 User rank is Captain (20000 - 30000 Reputation Level)don94403 User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 32 m 3 sec
Reputation Power: 251
Quote:
Originally Posted by Jake02
I have a search menu where the user can choose a search option:

1. Search by Date Filed
2. Search by Paid Date
3. Search by Invoice No.
4. Search by Client Name

etc....

I have a query built for each of these options, 14 in all. Is there a way that I could have the user enter more than one option, and link those queries together? For example, they could enter 1 and 4 to search for Client Name on a particular filing date.

I would rather not have to write a query for each and every option...

Thanks.

You would need to write VBA code to check every checkbox to see if it has been selected or not. Your code would then build the SQL syntax to do that. It's done all the time, but it can be quite a job to write it--and debug it, with that many options.
__________________
Experience is the thing you have left when everything else is gone.

Reply With Quote
  #3  
Old May 6th, 2008, 06:34 PM
Jake02 Jake02 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 58 Jake02 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 51 m 19 sec
Reputation Power: 1
Thank you...I'll see if I can figure out the code.

Reply With Quote
  #4  
Old May 7th, 2008, 10:56 AM
rpeare rpeare is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 467 rpeare User rank is First Lieutenant (10000 - 20000 Reputation Level)rpeare User rank is First Lieutenant (10000 - 20000 Reputation Level)rpeare User rank is First Lieutenant (10000 - 20000 Reputation Level)rpeare User rank is First Lieutenant (10000 - 20000 Reputation Level)rpeare User rank is First Lieutenant (10000 - 20000 Reputation Level)rpeare User rank is First Lieutenant (10000 - 20000 Reputation Level)rpeare User rank is First Lieutenant (10000 - 20000 Reputation Level)rpeare User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 4 Days 7 m 47 sec
Reputation Power: 117
If you're looking all this information up from one table you can do it with one query. Let's say you have 5 fields in your table and you want to be able to look up by any one of those 5 fields and you have a form that the user can put in their search criteria.

so Tbl_Test (void is a yes/no, purchdate is a date)
Code:
Cust_ID  PurchDate  PurchAmt  ItemID  Void


Now depending on the nature of your ID fields you could have one query that was (I'm assuming Cust_ID and Item_ID are numbers for the purposes of this example):

now assuming your form that you set your criteria in is called Frm_Criteria and the fields are labeled Fld_001 through Fld_005 corresponding to the five fields:

Code:
SELECT Tbl_Test.Cust_ID, Tbl_Test.PurchDate, Tbl_Test.PurchAmt, Tbl_Test.ItemID, Tbl_Test.Void
FROM Tbl_Test
WHERE (((Tbl_Test.Cust_ID) like "*" & [forms]![frm_criteria]![Fld_001] & "*") AND ((Tbl_Test.PurchDate) like "*" & [forms]![frm_criteria]![Fld_002] & "*") AND ((Tbl_Test.PurchAmt) like "*" & [forms]![frm_criteria]![Fld_003] & "*") AND ((Tbl_Test.ItemID) like "*" & [forms]![frm_criteria]![Fld_004] & "*") AND ((Tbl_Test.Void) like "*" & [forms]![frm_criteria]![Fld_005] & "*"));


Something like this query will show pick up the value from your input form if it exists, if it doesn't it will pick everything. The only place you're run into trouble is if your ID is an autonumber then you would have to do something fancier to get that to come out right. If, however, you're using independently generated ID's (which I usually do) it should work fine.
__________________
----------------
If we've helped you and you have solved your problem please post that it's been resolved so we know! The suspense kills me!

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Queries - Use multiple queries


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway