Creating a text box similar to a combo box

Spam808

Registered User.
Local time
Today, 00:18
Joined
Dec 3, 2018
Messages
55
Currently I have a combo box display a list of items. When you select an item it populates the other text boxes. Instead of using a combo box I would like to use a text box by typing the name of the item. How would you do this?
 
Hi,

Lots of different ways but one way is to use DLookup().
 
Hi theDBguy,

How should I adjust my current coding, comname2 is my combo box.

Private Sub ComName2_AfterUpdate()
Me.Name2 = Me.ComName2.Column(1)
Me.Type2 = Me.ComName2.Column(18)
Me.Class2 = Me.ComName2.Column(5)
Me.Growth2 = Me.ComName2.Column(6)
Me.Rate2 = Me.ComName2.Column(3)
Me.Unit2 = Me.ComName2.Column(4)
End Sub
 
To be fair using a combo is by far the easiest and most reliable method.
It has numerous advantages over a normal text box for this type of operation.

Firstly all the data you want is already there - as you are doing at the moment, simply retrieve the column values.

Secondly Users can't mis-type and enter something that doesn't exist, and if they do you have a selection of events you can use to handle that.

With a textbox, you would have to do the lookup or open a recordset to find the text, handle the fact it wasn't found, or do a load of other DLookups if it was found. (all of which is significantly slower).

What is steering you away from the combo ?
 
I'm new to Access and I started using Dlookup/Lookup which worked. Then I was shown how to use combo boxes and found them so much more flexible and easier. They can be set so that the user can only select data that is in the list or by using a NotInList event you can add a new item to the list but not do so accidentally, A messagebox will pop up telling you what has been typed is not in the list and ask if you want to add it with the options of yes or no.

I'll not go back to Dlookup/Lookup.

I can't help/advise you with how to use them, only let you know that I find combo boxes so much easier.
 

Users who are viewing this thread

Back
Top Bottom