Auto Add Data

G

Guest

Hi

I run Win2k with Access 2k. I have posted this question a couple of times
and although people have tried to help me I just dont get it. This is my
problem;

I have a table called "Colours"

In column 1 (called Code) I have a unique number ie EX90028-D
In column 2 (called Colours) I have a colour ie Green

EXAMPLE:

Column 1 Column 2

Code Colour
EX90028-D GREEN
EX90029-D RED
EX90030-D BLUE

Colum 1 is designated the primary key

I have a query called Colours which includes both Column 1 and Column 2

I want to create a form that has a Combo box that lists the Codes and a text
box that automatically lists the corresponding colour to which ever code is
selcted in the Combo box.


I apologise for any inconvienence that I have put people through with this
issue. Would it be possible for anyone to email me and example of this so
that I could work it out along with any explanation that is given to me?

My email addess is (e-mail address removed)

Thank You

John
 
D

Duane Hookom

Your combo box should have these properties:
Name: cboCodeColour
Row Source:
SELECT Code, Colour
FROM Colours
Order By Code;
Column Count: 2
Bound Column: 1
Column Widths: 1,0

Add a text box to your form and set its control source to:
=cboCodeColour!Column(1)
 
J

Jeff Boyce

John

Your form has two fields, a combo box and a text box.

Your combo box is based on a query that returns two columns, the Code and
the Colour.

In your combo box's AfterUpdate event you add an expression something like:

Me!YourTextBoxName = Me!YourComboBoxName.Column(1)

This will put the Colour in the textbox after you select a Code.

Now, why do you want to keep the Code displayed? If you actual, eventual
aim is to let people pick an actual Colour, then you can do it in a single
combo box.

Use the Column Width property of the combo box and set it to something like:

0;1

This stores the Code, but displays the Colour. And it has the advantage of
allowing the user to select by the name of the Colour, rather than by some
hard-to-remember Code.
 
G

Guest

Thanks for all your help.

Jeff, I work in the Painted Steel industry so the reason I have the opted
for the code to retain itself and the colour to display automatically is that
this database is being designed for production employees that are very
familiar with "paint codes" (of which there are over 900). There may be 5 or
6 entries during a shift that has the same code and colour but the rest of
the information (which I will add to the database) may change 4 or 5 times.
It is just to save the user from re-entering the code & colour every single
time they have an entry. Hope this helps you understand my reasons for doing
this way.

Thanks again
 
J

Jeff Boyce

Thanks for the further explanation, John.

It was only a thought, and it sounds like your setup works in your
situation.

Regards

Jeff Boyce
<Office/Access MVP>
 

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