Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Search Form 2.0    Comments List
Pending Approval    Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 

Anonymous 
 
Sandra Truax  @Reply  
         
22 hours ago
Jan Zimmermann  @Reply  
   
22 hours ago
Thanks. The SQL string has two WHERE conditions. I've slso tried it with recordsets. It didn't work.
Jan Zimmermann  @Reply  
   
22 hours ago
It's based on Check Form 2.0
Kevin Robertson  @Reply  
          
22 hours ago
Jan An SQL string should have only one WHERE condition.
Jan Zimmermann  @Reply  
   
19 hours ago
WHERE YEAR = 2026 AND Month = 6
It works
Alex Hedley  @Reply  
            
18 hours ago
What didn't work?
Jan Zimmermann  @Reply  
   
7 hours ago
I have a form with a subform and a corresponding report. The parent form contains two boxes: YearCombo and MonthCombo.

When the subsequent PrintBtn function is used, for example, to select 2026 and 6, it displays the correct values in the first column of the report, but the report then continues to show all months.
SQL statement:

DetailsPrivate Sub PrintBtn_Click()
    Dim SQL As String, WhereStr As String, OrderBy As String

    WhereStr = ""
    If YearCombo <> "" Then
        If WhereStr <> "" Then WhereStr = WhereStr & " AND "
        WhereStr = WhereStr & "Jahr = " & YearCombo

    End If
    If MonthCombo <> "" Then
        If WhereStr <> "" Then WhereStr = WhereStr & " AND "
        WhereStr = WhereStr & "MonatID= " & MonthCombo
    End If

     SQL = "SELECT * FROM tblExpenses"

    If WhereStr <> "" Then
        SQL = SQL & " WHERE " & WhereStr
    End If
''''
'''''    SQL = SQL & " ORDER BY " & SortField
'''''    If SortHow = "Z-A" Then SQL = SQL & " DESC"
''''
    SQL = SQL
    SQL2 = SQL
    Me.RecordSource = SQL

    SQL = Me.Filter

    
    DoCmd.OpenReport "repNeu - Copy", acViewReport, penArgs:=Me.RecordSource

End Sub

Jan Zimmermann  @Reply  
   
7 hours ago

Jan Zimmermann  @Reply  
   
6 hours ago
Solved it. Set the combo boxes directly to the query. No SQL. Thanks to all!
Add a Reply Upload an Image
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: 7/22/2026 7:36:13 AM. PLT: 1s