Recall combo box from a text box (1 Viewer)

Capitala

Member
Local time
Today, 17:40
Joined
Oct 21, 2021
Messages
58
In a combo box without control source, it comprises 3 columns: id, a_name, amount.
I use it to recall data from a certain table.
Is it possible to fill in the combo box based on the data in a text box.
Ex. When entering a name in the a_name text box, combo box should show the same accordingly.
Sample attached.
Thanks in advance.
 

Attachments

  • Database2.accdb
    448 KB · Views: 348

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 12:40
Joined
Feb 28, 2001
Messages
26,999
This is an unusual request. You don't have unlimited space for adding new records to an unbound combo and further, doing what you just asked would have the effect of creating an entry with blanks for the two other fields. What do you do if someone actually selects something from the combo and the name is there, AND THEN your user enters a name in the text box after a selection has been made?

What is the problem (IN WORDS) that you are trying to solve?

Now, so that you don't think I'm ignoring your question, it is possible using VBA code to move data from point A to point B behind the scenes assuming you have a viable triggering method to cause the move to occur when appropriate. To completely answer your question, WHEN should this data move occur? Need to know this in order to decide WHEN to do it. The HOW is always the same - a VBA statement:

cboB = txtA

The trick is when and where to do it.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:40
Joined
Feb 19, 2002
Messages
42,971
I've attached a sample that may help. The best solution whey you want to show multiple columns from the lookup table rather than just the name, is to join the main table with the loolup table using a left join. Then you can select whatever columns you need from the lookup table. HOWEVER, you should also set the locked property of those fields from the lookup table to Yes to prevent accidental updating.
 

Attachments

  • FillFormFields_20210319.zip
    101.6 KB · Views: 345

Users who are viewing this thread

Top Bottom