Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Search Form 2.0    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Help with Where clause
Walter Hamilton 
    
4 years ago
I've built a search form with 11 different combo boxes and 10 of them work great.  The 11th combo box has different statuses that change depending on the PoP End Date.

Active -  [PoPEnd] >Date()+60
D-60 - [PoPEnd] >Date+30 and [PoP End] <=Date()+60
D-30 - [PopEnd] >=Date() and [PoP End] <=Date()+30
Expired - <Date()

That portion of my SQL string looks like this:

& "IIf([tbl_Charge Codes].[PoP End]>Date()+60,""Active"",IIf([tbl_Charge Codes].[PoP End]>Date()+30 And [tbl_Charge Codes].[PoP End]<Date()+60,""D-60"",IIf([tbl_Charge Codes].[PoP End]>=Date() And [tbl_Charge Codes].[PoP End]<Date()+30,""D-30"",""Expired""))) AS Status, " _
    & "IIf([Status]=""Active"",""1"",IIf([Status]=""D-30"",""2"",IIf([Status]=""D-60"",""3"",IIf([Status]=""Expired"",""4"")))) AS Status_ID " _

My current where clause for the Status_ID looks like this:

If Status_ID <> "" Then
        If WhereStr <> "" Then WhereStr = WhereStr & " AND "
        WhereStr = WhereStr & "Status_ID=" & Status_ID

The form requeries but it doesn't filter by the Status_ID.  All Statuses show up.

Is there a way to do the calculations within the Where Clause for the Status_ID instead of adding it to the "Query" poertion of the SQL statement?
Adam Schwanz  @Reply  
           
4 years ago
Merge/Delete with First Post

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Search Form 2.0.
 

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: 4/15/2026 6:17:52 PM. PLT: 1s