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 Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Passing a Text Box Value to a ComboBox
Kenneth B 
    
13 years ago
In The Project I am working on I made a Form with 1 Text box in and and 2 Combo Boxes. One Combo box to work with Employee IDs and One Combo Box to work with Equipment IDs. All Employee IDs at work Start with 0 and are 8 characters long and all Equipment ID's start with 1 and are 5 Characters long. What i want the Text Box to do is Take in ether The Employee ID or the Equipment ID and pass it to the Correct Combo Box.In the after update of the Text box I use the InStr Function to tell if the first Number is a 0 or 1. If its 0 i want it to pass that value to the Employee ID Combo and Clear out, If its a 1 then i want to pass it to the Equipment ID Combo and Clear out. with this Code:

Private Sub Scanner_AfterUpdate()

If InStr(Scanner, "0") <> 0 Then
SFEmpIDCbo.Value = Scanner
Scanner = ""
End If

End Sub

The Combo Box of the Employee ID Combo is still blank

I have not written the second part of that code for the 1 value until i can get the first combo box to work.

The Combo Boxes job is to Open a Form to the 1 record where the value in the box Match the ID in the table

When the EmpIDC Combo gets the value it will open up the Employee Form

When the Equipment ID Combo box gets the value it will open up the Equipment Form




Reply from Richard Rost:

InStr checks the WHOLE string, not just the first character. If you want to look at the first character, use LEFT.

If LEFT(Scanner,1)="0" then ...

You could also use the LEN function to check the length of the string.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access 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/15/2026 6:28:35 AM. PLT: 1s