Ask Your Question
1

Field connected to combobox in form - base

asked 2016-07-09 22:56:23 +0200

flamingo gravatar image

updated 2018-11-17 06:28:46 +0200

EasyTrieve gravatar image

I want to put a field on a form, so that i can select one item from a combobox and this field retrieves the possible items from a table. How to do this?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
0

answered 2016-07-10 01:44:20 +0200

Ratslinger gravatar image

You can do this using a filter. Attached is a sample. There are two tables - Bike (main table containing Bike info) and Filter (just one record used to hold listbox selection).

There are two forms - Bike (to enter data for the main table) and the one you're interested in Bike2.

The Bike2 form has a main form and a subform. On the main form is the listbox. The list is generated from the Bike table ID's (see the Data tab of the properties box in MainForm) and the selection is stored in the first record of the Filter table. The remainder of the controls reside on the subform named SubForm. The subform points to the Bike table and is linked to the Filter table (see the Data tab of the properties box in SubForm). When you press the button, the subform is Refreshed (set in button property General tab), and using the BikeID in the Filter table, reads the record in the Bike table and displays it.

Sample: SelectByFilter.odb

edit flag offensive delete link more
0

answered 2018-11-17 06:38:40 +0200

EasyTrieve gravatar image

updated 2018-11-17 06:42:30 +0200

I call what you're doing a lookup. You're looking up a value for a field in your primary table, from a list of values given in another table.


In Base a combobox returns the value you select from a list. Note that it can't return the ID or any other field from the table you lookup into.. (Note that in Access a combobox can do this.)

A listbox can return the ID of the values you see.

For example:

If you have a lookup table called colors, with these records:

COLOR
---------
Red
Blue
Green

Then in your primary table you can select one of these values with a pull down box by using a combobox. The combobox field in this case will need to be some sort of text field.

OR, If you have a lookup table called colors, with these records:

ID  COLOR
--- -----------
1   Red
2   Blue
3   Green

Then in your primary table you can have an integer field, and use a 1listbox` to lookup a name and return it's id. So when you pull down the box, you see: Red, Blue, .. but when you select Blue, it puts 2 in the field.

edit flag offensive delete link more
0

answered 2018-11-17 06:19:44 +0200

I too have been struggling with this. The answer given is for a list box where it clearly asks for a combo box. I looked at the example and the bike2 form is what I need but in combo box NOT list box.

edit flag offensive delete link more

Comments

Thanks, but this is not an answer, which is the box you typed this into. Please move this comment and put it into a comment below the answer to which it refers. Then remove this answer. Thanks.

EasyTrieve gravatar imageEasyTrieve ( 2018-11-17 06:29:56 +0200 )edit

@Bretts Express There are some minor differences between a list & combo box. For this question those differences are not relevant. It operates the same regardless of the type used.

The main differences between the two - With a combo box you can enter items even if they are not part of the list & list box you cannot; In a list box the value displayed and the saved value can be different but not in a combo box.

Any further questions should be asked as a new question.

Ratslinger gravatar imageRatslinger ( 2018-11-17 16:57:32 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-07-09 22:56:23 +0200

Seen: 374 times

Last updated: Nov 17 '18