default value for combo box in a sub subform

R

randria

Hi,

I have a combo box (cbo2) in a sub subform of a continuous form. I put On
Form_Load() of the sub subform :
Me.cbo2.value = Me.cbo2.itemData(0)
When I open the sub subform on its own, I get the default value for new
record appearing. But when I open the same sub subform within the main form,
I do not see the default value for new record. What could be the problem ?
Many thanks.
 
M

Marshall Barton

randria said:
I have a combo box (cbo2) in a sub subform of a continuous form. I put On
Form_Load() of the sub subform :
Me.cbo2.value = Me.cbo2.itemData(0)
When I open the sub subform on its own, I get the default value for new
record appearing. But when I open the same sub subform within the main form,
I do not see the default value for new record. What could be the problem ?


That code will change the value of the combo box in the
first record regardless of whether it's a new record or not.
In addition, it will dirty the record even if the user did
not intend to make any changes.

Maybe you should set the DefaultValue property instead of
the Value property? The DefulatValue property is only
applied on the first keystroke on a new record, but you
should always see it displayed on any new record.

Me.cbo2.DefaultValue = """" & Me.cbo2.ItemData(0) & """"

OTOH, maybe I don't understand what you are trying to do.
 

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