By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,660 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,660 IT Pros & Developers. It's quick & easy.

Type Ahead Code for Access 2003

P: 2
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
This is my first time writing code and using Access. The easier the better.

Any assistance will be appreciated.

Dec 15 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 3,532
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)>

Dec 15 '08 #2

P: 2
Thank you! It works fine!

My first time posting. Sorry for the double posts.
Dec 15 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.