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 
Search SubForm
Sandra Truax 
         
4 years ago
For the members version, can you tell me how to make it filter a subform? No matter what I try, it won't work and I am trying to get out of completely redesigning my database.  

WhereStr = WhereStr & "FirstName like ""*" & FirstNameSearch & "*"""

My formname is Budget, my subform is TransactionList. The unbound search fields are on the main form.  Thanks.
Kevin Robertson  @Reply  
          
4 years ago
Are you using the correct Subform notation to set the RecordSource?

Value From A Form

Forms!FormName!SubformName.Form.RecordSource
Sandra Truax OP  @Reply  
         
4 years ago
There's the problem. I was leaving off the Form. before the RecordSource.  Thank you SO much!
Sandra Truax OP  @Reply  
         
4 years ago
Thanks for the link! I just now noticed it. :)
Sandra Truax OP  @Reply  
         
4 years ago
I'm still getting an error saying Access can't find the field "AccountTransactionF"

   WhereStr = ""
    If AccountSearch <> "" Then
         WhereStr = Forms!Budget!AccountTransactionF.Form.Account Like "" * " & AccountSearch & " * """"
   End If
Kevin Robertson  @Reply  
          
4 years ago
You said the search fields were on the main form so the code including the SQL statement is also on the main form.
You should only need that notation for the RecordSource of the Subform.

WhereStr = WhereStr & "Account Like ""*" & AccountSearch & "*""""

If this doesn't work please upload some screenshots.
Sandra Truax OP  @Reply  
         
4 years ago
The SQL2 displays correctly "SELECT * FROM Budget_Q WHERE account LIKE "*0222*", but it still won't filter my subform. This is my code.  I even deleted my Account in the subform because it was a combo box, and just put in the Account field, and it still won't work. I created a new form that doesn't have a subform, and it works in it. I've used it for years filtering the subform with the search fileds and a query box, but really wanted to get this to work. Thanks again for looking at my work.

Private Sub RequeryForm()
    Dim SQL As String
    Dim WhereStr As String
    
    WhereStr = ""
    If AccountSearch <> "" Then
        WhereStr = "account LIKE ""*" & AccountSearch & "*"""
    End If
    
    SQL = "SELECT * FROM Budget_Q"
    
    If WhereStr <> "" Then
        SQL = SQL & " WHERE " & WhereStr
    End If
    
    Me.RecordSource = SQL
    SQL2 = SQL
End Sub

Private Sub SetDefaults()
    AccountSearch = "-"
End Sub

Private Sub AccountSearch_AfterUpdate()
    RequeryForm
End
Sandra Truax OP  @Reply  
         
4 years ago
Never mind! I figured it out. I had to use Me.AccountTransactionF.Form.Recordsource = SQL and then it worked!

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: 5/5/2026 6:20:29 PM. PLT: 1s