Default Value in Combo Box? 
Author Message
 Default Value in Combo Box?

I have a data entry form in which a combo box gets its values from a Query.
I would like the combo box to display the first record returned from the
query as its default value.  Or maybe another way is to create an event
procedure that opens the combo box and then moves to the first value and
selects it.  In my attempt to reduce the data entry work, 90% of all values
to be chosen are the first values.  Is there a formula for finding the first
record that could be placed in the Default Value of the combo box?


Mon, 12 Mar 2001 03:00:00 GMT  
 Default Value in Combo Box?
Copied from Access 97 help:

Specify a default value that is automatically entered in a combo box

1  Open a form in Design view.
2  Make sure that the combo box is selected and then click Properties on the
toolbar.
3  In the DefaultValue property box, type [comboboxname].ItemData(n) where n
is the row that you want to use as the default. The ItemData property is
zero-based, so type ItemData(0) if you want to make the first row in the
list the default. For example, to specify the first row of the SupplierCombo
combo box as the default for the combo box, type [SupplierCombo].ItemData(0)
in the DefaultValue property box.
--
Doug
Reply to is anti-spammed remove the "z" from email

Quote:

>I have a data entry form in which a combo box gets its values from a Query.
>I would like the combo box to display the first record returned from the
>query as its default value.  Or maybe another way is to create an event
>procedure that opens the combo box and then moves to the first value and
>selects it.  In my attempt to reduce the data entry work, 90% of all values
>to be chosen are the first values.  Is there a formula for finding the
first
>record that could be placed in the Default Value of the combo box?



Mon, 12 Mar 2001 03:00:00 GMT  
 Default Value in Combo Box?
Thanks,
As much for the answer as how to find the answer.  I had looked in Help but
either overlooked it, or searched in the wrong places.  We all owe it to
ourselves to use Help first.  I often read stuff I wasn't even looking for
to expand my knowledge.  Sometimes I just plain can't find it.  Again, a
sincere Thanks!

And now for the bad news.  I still can't get it to work as described.  No
error messages.  Simply a combo box with a blank field.  The list is correct
when I open it. I tried both a value or "0" as well as "1" in the
expression. And I see nothing as a default in the combo box.  Even after a
manual update of the form nothing changes.

John



Quote:
>Copied from Access 97 help:

>Specify a default value that is automatically entered in a combo box

>1  Open a form in Design view.
>2  Make sure that the combo box is selected and then click Properties on
the
>toolbar.
>3  In the DefaultValue property box, type [comboboxname].ItemData(n) where
n
>is the row that you want to use as the default. The ItemData property is
>zero-based, so type ItemData(0) if you want to make the first row in the
>list the default. For example, to specify the first row of the
SupplierCombo
>combo box as the default for the combo box, type

[SupplierCombo].ItemData(0)
Quote:
>in the DefaultValue property box.
>--
>Doug



Tue, 13 Mar 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to set default value of combo box to value of record in database

2. default value in combo box to last selected

3. Default Values for Combo Box Style 2

4. Default value for Combo Box!

5. Combo box default value - Help!

6. Default value for dropdown combo list box?

7. setting a default value to a Combo box

8. Combo boxes don't default to current value

9. Populate a Combo Box with default value...

10. enter data in a combo box based on value from another combo box

11. Putting a value from a combo box into a text box on a form

12. Save Text Boxes Values To Combo Box's Item

 

 
Powered by phpBB® Forum Software