Option Group Values

G

Guest

Hi all,

I have set up an option group in a form exactly like the shipvia in
northwinds orders. It works fine exept that in my table it just stores the
option group value. I looked at the northwind orders table and it has text
stored even though the shipvia field's format is a number. I have tried doing
the same but it just gives me an error about incorrect formats.

I'm very confused what have i missed.

TIA

Rico
 
G

Guest

Hi Rico-

You need to look a little more closely at the field's definition. If you
open the Orders table in Design View, click on the ShipVia field row & then
click the Lookup tab in the Properties pane you'll see that the field is
displaying information from the Shippers table. The field is actually storing
the Shipper ID number.

Hope this helps |:>)
 
G

Guest

Thats exactly what i dont understand. How, if it is storing the ShipperID (a
number) then in data sheet mode it shows the name corresponding to that id
(in a number field i might add), how is this possible?

TIA

Rico
 
T

Tom Collins

That's because it's doing a lookup.
If you go into Design mode for the Orders table, select the ShipVia field
then click on Lookup in the properties window, this will show you how it's
done.

Tom Collins
 
F

fredg

Hi all,

I have set up an option group in a form exactly like the shipvia in
northwinds orders. It works fine exept that in my table it just stores the
option group value. I looked at the northwind orders table and it has text
stored even though the shipvia field's format is a number. I have tried doing
the same but it just gives me an error about incorrect formats.

I'm very confused what have i missed.

TIA

Rico

The Northwind example database uses the discredited LookUp field in
the table, which is hiding the actual field value.

The field itself is actually storing the number value, but it is
confusing you by showing the text equivalent as in a combo box.

In Table Design View, click on the field name and you will notice that
it's datatype is Number. Then click on the LookUp tab (in the lower
panel) and you will see the Display control is Combo box. The combo
box Row Source property is a SQL that shows the text equivalent, not
the actual value.

You can see this for yourself by changing the Display Control to Text
Box. Save the changes. Open the table and you will see the actual
number shown instead of text.
Change the display Control back to Combo Box, to restore the database
to it's original state.

The better method is to just store the Option value as a number in a
regular Text Box field.

You can easily enough display the corresponding text value for the
option, using a Select Case, or If..Then.. Else by Code or an IIF()
or Choose() function in an unbound control on a form or in a report,
i.e.
=Choose([ShipVia],"FedEx","UPS","DHL")
or..
=IIf([ShipVia] =1, "FedEx",IIf([ShipVia]=2,"UPS","DHL"))
 

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