Connecting Tech Pros Worldwide Forums | Help | Site Map

Combo box default value

carmela_wong@hotmail.com
Guest
 
Posts: n/a
#1: Jun 6 '06
Hello all,

I am trying to set the default value of a combo box to "USA" which does
not work although I have entered this in the Default Value property of
the control. The combo box shows the values "USA", "Canada" and "Mexico
in the drop-down menu. I am able to accomplish this in a list box but
that is not what I want. I need the combo box.

Thank you for any advice.
CW


Rick Brandt
Guest
 
Posts: n/a
#2: Jun 6 '06

re: Combo box default value


carmela_wong@hotmail.com wrote:[color=blue]
> Hello all,
>
> I am trying to set the default value of a combo box to "USA" which
> does not work although I have entered this in the Default Value
> property of the control. The combo box shows the values "USA",
> "Canada" and "Mexico in the drop-down menu. I am able to accomplish
> this in a list box but that is not what I want. I need the combo box.
>
> Thank you for any advice.
> CW[/color]

Is the RowSource a ValueList?

Is the control Bound?

Is there more than one column (including hidden ones)?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


carmela_wong@hotmail.com
Guest
 
Posts: n/a
#3: Jun 6 '06

re: Combo box default value


Yes, RowSource is a Value List and the control is bound. There are no
more columns.
Thanks for replying
CW

Rick Brandt
Guest
 
Posts: n/a
#4: Jun 6 '06

re: Combo box default value


carmela_wong@hotmail.com wrote:[color=blue]
> Yes, RowSource is a Value List and the control is bound. There are no
> more columns.
> Thanks for replying
> CW[/color]

And you are definitely moving to a new record when opening the form?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


carmela_wong@hotmail.com
Guest
 
Posts: n/a
#5: Jun 6 '06

re: Combo box default value


Here is what happens: I look up an Order number on the main form. The
subform shows all the line items for that order. It is that subform
that has the combo box. I want it to show USA as the default which then
gets saved in the country field of each record for the order. Country
could be changed to Canada or Mexico prior to saving. The wierd thing I
just noticed is that the value does not get saved in the country field
unless I go and select country value for each line individually. It
does not just save the default value in the field.
Thanks

Rick Brandt
Guest
 
Posts: n/a
#6: Jun 6 '06

re: Combo box default value


carmela_wong@hotmail.com wrote:[color=blue]
> Here is what happens: I look up an Order number on the main form. The
> subform shows all the line items for that order. It is that subform
> that has the combo box. I want it to show USA as the default which
> then gets saved in the country field of each record for the order.
> Country could be changed to Canada or Mexico prior to saving. The
> wierd thing I just noticed is that the value does not get saved in
> the country field unless I go and select country value for each line
> individually. It does not just save the default value in the field.
> Thanks[/color]

The default value only applies to NEW records. If you added this field and
ComboBox and then look at existing orders it is going to still show null
because that is the value stored in those records. If you look at the last
"new record" row on your subform you should see the default value show up
there.

For existing records you would need to run an update query to set them all
to USA and then you could use the ComboBox on individual records that needed
to be set to something else.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


carmela_wong@hotmail.com
Guest
 
Posts: n/a
#7: Jun 6 '06

re: Combo box default value


Thank you for your help. I understand how this works now.
Have a great day!

Closed Thread