Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Find Record Combo    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Combo Search
David Cooke 
     
3 years ago
Good Afternoon,

I watched Combo search video https://www.youtube.com/watch?v=vS2ZlUKu26A&t=0s and I get the below error. and get the attached error.  Below is the code I used.  Thank you

Code:
Private Sub AddToFilter(FilterComboName As String)

    If IsNull(Me(FilterComboName)) Then Exit Sub
    If TempVars("Filter") <> "" Then TempVars("Filter") = TempVars("Filter") & " AND "
    TempVars("Filter") = TempVars("Filter") & Left(FilterComboName, Len(FilterComboName) - 6) & "=""" & Me(FilterComboName) & """"
    
    

End Sub
Private Function UpdateFilter()

    Dim C As Control
    
    TempVars("Filters") = ""
    For Each C In Me.Controls
      If C.ControlsType = acComboBox Then
        If Right(C.Name, 6) = "Filter" Then AddToFilter C.Name
      End If
    Next
    Me.Filter = TempVars("Filter")
    Me.FilterOn = (TempVars("Filter") <> "")

End Function

I added =UpdateFilter() to AfterUpdate property.

David Cooke OP  @Reply  
     
3 years ago

Kevin Robertson  @Reply  
          
3 years ago
In the AddToFilter() sub you have missing code. You have an And, but nothing after it.

If TempVars("Filter") <> "" Then TempVars("Filter") = TempVars("Filter") & " AND " ??????????

In the video this is the AndOrCombo.
Rewatch the video and you will see what's missing.
David Cooke OP  @Reply  
     
3 years ago
Hi Kevin,

Thanks for responding.  I must be blind as I don't see it in Richard's video.  See screen shot at the point where he tests it his code and it works.

Thansk again!
David Cooke OP  @Reply  
     
3 years ago

Kevin Robertson  @Reply  
          
3 years ago
Sorry. I read the code wrong.

Have a look in the UpdateFilter() function, The first TempVars is "Filters", all the others are "Filter".
Kevin Robertson  @Reply  
          
3 years ago
When you click the OK button in the error message is there a line of code highlighted?
Kevin Robertson  @Reply  
          
3 years ago
OK. Just spotted the problem and tested it with Richard's database. I got the same error message.

If C.ControlsType = acComboBox Then

should be

If C.ControlType = acComboBox Then

An extra 's' causing problems.
Richard Rost  @Reply  
          
3 years ago
Kevin, are you saying there's a bug in the original database?
David Cooke OP  @Reply  
     
3 years ago
Thank you Kevin!  No more error but when I select the the first combo nothing happens and i know something is there.  :)  I waiting to get access to the code so I can compare it better.

Thanks again
Dave
David Cooke OP  @Reply  
     
3 years ago
I was able to get it to work but had to rebuild a new DB and apply the code.  Not sure why I couldn't to get it to work on the original.  Richard not a bug, just an issue with  my spelling errors and weird DB file.

Thank you all!  Have a great day!

Richard Rost  @Reply  
          
3 years ago
Good to know. I always suggest if something that you learn in one of my videos doesn't work the first time to go and try my original database download because if that works then the issue is something in your database obviously. However I have been known to make mistakes. It's happened once or twice in the last 50 years. LOL.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Find Record Combo.
 

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/2/2026 1:38:31 AM. PLT: 1s