View Full Version : combo selection


thomasfarrand
04-02-2002, 07:48 AM
Can some one please help me coz i think im going around in circuls!
I've got a form which i want 2 use to fill in new appointments. What i want to be able to do is select a clients name from a combo box and at the same time, i want it to automaticly fill in the client_ID similar to what happens in the access sample db Northwind in its Orders form.
Having studuid Northwinds example for a very long time i know that it all runs off of a query, but i can't seem to get it to work in mine even when following the example as closely as possible!is there settings or hidden code that im missing somewhere?
Im aware of the vbscript used in the after update procedure, this i have also followed.
Something u should also know is that i've got Client_Name and Client_ID in both the Client table and the Appointment table, is this right? if so for the query which table should a draw the Client_Name and Client_ID from?

Sorry for rambling on but im trying to give u as good a picture of the problem as i can! I will be very greatful if someone could help me with this coz i need to have it done in the next couple of days and im running out of time!

Thanx alot TOM...

edtab
04-02-2002, 05:24 PM
The data source of your combo box should be the Client table. The data source for your main form should be the Appointment table.

When you create the combo box using the Combo Box Wizard, select the first radio button to "look up values in a table". Select your Client table as the source.

When selecting the fields from the Client table, include the Client ID as your first field, followed by the Client Name.

The next window should give you two choices, one to store value for later use and the second one "Store value in this field". Choose the second one.

You will then be presented with all the fields of your Appointment table.
Choose Client ID as the field where you want to store the result of the combo box.

If you do everything correctly, your Client ID should automatically be entered in the Appointment table.

By the way, you do not need the Client Name in the Appointment table. This defeats the purpose of relational databases, ie. no duplication of entries in various tables as much as possible.

Once you have the Client ID entered in your Appointment table, you can then pull in the name from the Client table by relating the two tables in a query definition. This query should then be the source for generating your reports ( if you are doing one ).

See if this works for you.