Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Search button error
Robert Baier 
     
3 years ago
I'm a beginner and have created a field search button using the code in Richard's video.

Private Sub Searchlastnamebtn_Click()
    Dim S As String
    
    S = InputBox("Please enter Last Name", "Last Name", [LastName])
    If S = "" Then Exit Sub
    
    Me.Filter = "[LastName] = """ & S & """"
    Me.FilterOn = True
End Sub


I believe the code is correct, but get an error message that there was a problem communicating with the OLE server or ActiveX control. I don't know how to correct that.

Thanks,

Bob
Robert Baier OP  @Reply  
     
3 years ago

Robert Baier OP  @Reply  
     
3 years ago
By the way, I know the [] shouldn't be needed around the field name unless there are spaces, but the results are the same with or without.
Kevin Robertson  @Reply  
          
3 years ago
Follow these steps to see if they help:

First copy your code and paste into Notepad for safe keeping.
Delete the button.
Compact your database.
Add a new button.
Paste in your code.

Let us know if this fixes the problem.
Robert Baier OP  @Reply  
     
3 years ago
Kevin,
The error message is unchanged.

bob
John Davy  @Reply  
         
3 years ago
Hi Bob
I recreated the table and form and used your code. It worked as it should.  John
Kevin Robertson  @Reply  
          
3 years ago
Is it just this button causing problems? Does it work on other forms?
Perhaps create a new form, for testing purposes, to see if the button works there.
Or create a new database and import all object from this database to the new one.

Definitely nothing wrong with the code. I have used similar code in past projects with no problems.

I suggest going through Richard's Troubleshooter
Robert Baier OP  @Reply  
     
3 years ago
Thanks for the suggestions. It appears that I may have a form issue and an Office or Windows problem. When I create a button in a different form or a different database, I don't get an error message but it does not do anything. Same with a duplicate record button. I'll try it on some different computers and see what happens. Hopefully and Office reinstall and new form will fix it.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

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 3:16:16 AM. PLT: 1s