Connecting Tech Pros Worldwide Help | Site Map

Type Ahead Code for Access 2003

 
LinkBack Thread Tools Search this Thread
  #1  
Old December 15th, 2008, 08:53 PM
Newbie
 
Join Date: Dec 2008
Posts: 2
Default Type Ahead Code for Access 2003

I have been trying to use this code to enable the type ahead function in a combo box within a form that I am using. The combo box contains the id#, old compound number and new compound number. What is the simplest way to enable the type ahead function?



This is the code I am using:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboCompound_Number_Change()
  2. Dim strTyped As String
  3.   Dim strSelect As String
  4.   strTyped = Nz(cboCompoundNumber.Text, "")
  5.   If Len(strTyped) = 3 Then
  6.     strSelect = "SELECT CompoundList.ID, NewPMXCompoundNumber, OldPMXCompoundNumber FROM CompoundList " & _
  7.        "WHERE CompoundNumber LIKE """ & strTyped & "*"" " & _
  8.        "ORDER BY CompoundNumber;"
  9.        cboCompoundNumber.RowSource = strSelect
  10.        End If
  11. End Sub
  12.  
This is my first time writing code and using Access. The easier the better.

Any assistance will be appreciated.

Thanks
Reply
  #2  
Old December 15th, 2008, 09:01 PM
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 2,842
Default

You don't need any VBA code! The Auto Expand property, what you are calling "type ahead function" is the default for comboboxes, and if it's been turned off, can be turned on again by selecting the combobox and going to Properties - Data and setting Auto Expand to Yes.

Your duplicate posting of this question/problem has been deleted! Please refrain from this prohibited behavior in the future.

From FAQs

Do Not Double Post Your Questions

Double posting is where you start a thread on a topic and then for some reason start another thread on exactly the same topic in the same forum. Please do not do this because

1. It makes it very hard for people to answer you especially if there are answers happening in all the threads you have started because they have to read 2 or more threads in order to see what has already been said.

2. It swamps the forum with your problem resulting in less attention for the other threads.

If you feel for some reason that you post has been overlooked (for instance it hasn't had any replies) please do not repost the question. Post a message to the thread you started, this will bump it back to the top of the thread list for the forum.

Thank you for your attention in this matter.

Welcome to Bytes!

Linq ;0)>

Moderator
Reply
  #3  
Old December 15th, 2008, 10:35 PM
Newbie
 
Join Date: Dec 2008
Posts: 2
Default type ahead vb code

Thank you! It works fine!

My first time posting. Sorry for the double posts.
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.