How to show the value of 1 field based on a selection from a drop down listbox

I am trying to create a simple database with names and phone numbers.
I want a drop down listbox to allow me to choose a name then next to it I want that person’s phone number to show up.

In access I could do this and the phone number would show up as text on the form and not inside a text box but that doesn’t seem possible here.

I’ve search for days and found examples, even with downloadable odb files which didn’t work for me…

I have a table populated with ID (column 1), Name (Column 2), phonenumber (Column 3)
The table is named tblContacts

I have a drop-down labeled: ChooseName. the Data Field is pointing to ID.
This ListContent is: SELECT “Name”, “ID” FROM “tblContacts”

I have a drop-down labeled: PhoneNumber (I prefer this not to be a drop down. A text box or just text would be preferable.). the Data Field is pointing to ID.
This ListContent is: SELECT “phonenumber”, “ID” FROM “tblContacts”

When I choose the name from the dropdown, the phone number drop down is blank. When I click the phone number drop down it doesnt show anything.

I only chose the drop down list because that had a setting for me to use a SQL command.

Anyone have any good ideas? Simple examples that I can follow?

Still growing with LO, but getting a headache now - LOL

Thanks

Mike

One of the problems is, forms can do complex things, the other forms can contain several forms and this can be related or not…

When you have two boxes on your form and one shall react on the state of the other the “other” needs to be on a higher level so a depending sub-form can show the selected row of your database.

Long time ago the following video helped me to understand where to change things.
At 8:30 the navigator is used to change the hierarchic order of the fields an so create a sub-form:

Thanks for the info Wanderer but unfortunately I couldn’t follow the video since I only speak English.
I tried auto generated English caps but they were not very helpful and I used google translate to make sure I understood which choices were being clicked in his context menus.
But I just couldn’t duplicate what he was trying to teach.

But also, this doesn’t seem to be what I am looking for.
In his example, he types in a few letters and every entry he has in his table that has those letters pops up.

That is default behavior for any any properly set up Listbox.

List boxes are primarily used for data entry but it appears you are wanting to display existing data.

Using a Listbox to display matching entries from existing data can be achieved with a FILTER table where the Listbox selection can be stored and the associated data is displayed on a SubForm.

Look at this example. If it is more like what you want to do, I can post detailed instructions on how to do this with your data table

Demo70.odb (22.3 KB)

This demo works he way I want but I don’t understand how it works.
When I check the button’s control, I expected to see something under EVENTS - MOUSE BUTTON PRESSED, but it’s blank.

how is this working?

Look at the tab “General” instead “Events”.
There is a field called “Action” = Refresh Form. This is the event to be triggered when the user hit the button.

I see that thank you.

I need more info please. So when the form is refreshed I expect a macro to run “onload” but I dont see that macro here.
Exactly where are the instructions telling base to grab and display the necessary data?

This uses no Macros

The Form document named FormListBox is comprised of a MainForm and a SubForm.

The MainForm uses the FILTER table as its data source and has one single Listbox control on it. When you make a selection from the list it is stored in the ListBox control. Because there is just the one control the cursor is automatically moved to the Subform which ensures that the selection in the ListBox is written into the F1 field of the FILTER table.

The SubForm uses the CHARACTERS table as a data source and the MainForm F1 field is linked to the ID field in the CHARACTERS table. That appears on the Data tab of the Form Properties dialog for the SubForm.

The PushButton control is on the SubForm, you can verify that using the Form Navigator found on the Form Design toolbar

On the General tab of the Properties: Push Button dialog the Action property is set to Refresh Form. So when you press the button the SubForm data is reloaded based on the F1->ID relationship.