Access: how to insert tekst in a combo box

G

Guest

I am trying to make a database. But I need to know how to insert a text field
in a combo box. Eg I am making a material outgoing tockt for a company. By
selecting a serial number a tool will appear on the MOT.

156449 arm chair

But now I want to add some text under this line item. eg
" the color has faded"

How can I do this. as the only option now is to fill in a serial number
which is in th list of products
 
V

Vincent Johns

lara said:
I am trying to make a database. But I need to know how to insert a text field
in a combo box. Eg I am making a material outgoing tockt for a company. By
selecting a serial number a tool will appear on the MOT.

156449 arm chair

But now I want to add some text under this line item. eg
" the color has faded"

How can I do this. as the only option now is to fill in a serial number
which is in th list of products

It appears to me that you have 2 kinds of things here:
- Serial number and type of tool (though most of the time I don't use
arm chairs as tools, exactly...)
- Comment about a specific instance of the tool

If the serial number refers to a specific instance, then my assumption
is wrong and you'll have to ignore what I'm about to say.

I suggest setting up 2 Tables, one of which you already have (and if the
serial number is unique, you can use that as its primary key), and the
other of which will contain at least 2 fields:

- Serial number or similar key identifying the tool type
- Comment
- Optional "Autonumber" field to identify this comment

For example, suppose Table [MOT], in which I identified [SerialNumber]
as the primary key, contains these records:

SerialNumber Name
------------ ------------
156449 Arm chair
228144 Screwdriver
285714 Widget
314159 Pi plate

and Table [Comments], in which [CommentID] is the primary key, contains
these:

CommentID SerialNumber Comment
--------- ------------ --------------------
1 156449 The color has faded
2 156449 Arms are missing
3 314159 Slightly battered
5 228144 Not orange enough


Then you can define Query [Q_List] using this SQL:

SELECT MOT.SerialNumber, MOT.Name,
Comments.Comment
FROM MOT LEFT JOIN Comments
ON MOT.SerialNumber = Comments.SerialNumber
ORDER BY MOT.SerialNumber;


[Q_List] will display these records:

SerialNumber Name Comment
------------ ------------ --------------------
156449 Arm chair Arms are missing
156449 Arm chair The color has faded
228144 Screwdriver Not orange enough
285714 Widget
314159 Pi plate Slightly battered


Using this Query as the basis for a Form (with 3 fields), I used the
Form to add a new record to the two Tables. I did have to save the
record after adding the new [SerialNumber] and [Name] fields, so that
there would be a record in [MOT] for the new [Comment] to link to.
Having done that, I was able to enter a value into the [Comment] field
for that [SerialNumber].

A Form containing three TextBoxes isn't quite the same as a ComboBox,
but you may be able to modify it to do what you need.

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top