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 
Combo Box VBA Run Time Error
Alan Higgins 
      
8 months ago
I have a combo box that users try to type in instead of using the drop list. Once they start typing a VBA Run time error pops up. Is there a way to suppress this error or set the combo box so the user cannot attempt to enter data?

Thank you.
Raymond Spornhauer  @Reply  
          
8 months ago
Alan

When users start typing in the combo box, it should be trying to select an option form in the combo box.

On your combo box properties, on the data tab, make sure the 'Limit to List' is set to YES.

You should show us the specific error message you're getting.  Additionally, are there any events or other code associated with this combo box?

-Raymond
Donald Blackwell  @Reply  
       
8 months ago
Alan Without knowing the exact error message I can only guess. If you have the "Limit to List" set to yes and/or Value List Edits set to no, then there is probably related to that.

To stop them from typing, you could add an keydown event to the combo box for example:

Private Sub MyCombo_OnKeyDown(KeyCode as Integer, Shift as Integer)
     if not keycode = vbKeyTab and not keycode = vbKeyReturn then KeyCode = 0
End Sub

This will prevent typing while in that field and force them to use the dropdown. You could also put "MyCombo.dropdown" before the End Sub to open it so they can pick something.

You can get other keycode constants you may want to allow at: https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/keycode-constants
John Davy  @Reply  
         
8 months ago
Hi Alan, You might try setting Limit to List to Yes, Allow Value Edit to No and List items form to nothing (leave it empty) They may still enter but just message.  John
Alan Higgins OP  @Reply  
      
8 months ago
I do have "Limit to List set to Yes. Thank you for your help, i will try your suggestion and post my results.
Alan Higgins OP  @Reply  
      
8 months ago
i figured out what was causing the errors when someone types in the text box with validation rules set up. The run time error 3316 failing on the VBA code i have set up to populate my ID field when a name is selected.
Private Sub ReaderCBO_Change()
Me.Readers.Value = Me.ReaderCBO.Column(1)
End Sub

It is failing on each of these i have coded for the combo boxes. If i remove the validation rules i don't get any errors if someone types in the combo box instead of using the dropdown list in the combo box. I don't know any other way to populate the ID field into the main database than to use this VBA code. I think my only option is the disable typing in the combo boxes.
Any suggestion would be appreciated. Thanks for all your help

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 10:02:29 AM. PLT: 1s