Default Value - Combo box

  • Thread starter Thread starter dimpie
  • Start date Start date
D

dimpie

Hi - How can i assign a default value for a combo box field on the form?

In my case i want to assign the defaukt value to a combo box from a field
from the previous form.

I already tried using the default property of the field, but it is not
working.

Please help!!!

Thank You,
 
First, forms don't have fields, they have controls. Only tables and queries
have fields, but I will assume you mean controls.
When you say previous form, do you mean the value you want for the combo's
Default Value is in a control on a different form?
If so, is the "previous" form still open? If not, did the "previous" form
open the current form? Or do you mean a previous record in the current form?
 
Thanks for correcting me. I meant controls.

Default Value is in a control on a different form?if so, is the "previous"
form still open? - Yes, the previous form is still open.

Thanks for your help!!
 
Okay, then in the Load event of the current form, set the Default Value of
the Combo to the text box on the other form:

If CurrentProject.AllForms("PreviousForm").IsLoaded then
Me.MyCombo.DefaultValue = Forms!PreviousForm!MyTextBox
End If

Of course you will need to change the form and control names to use yours.
 
This is still not working.
If the current forms control is a text box, then it will display the
contents. Once i change it to a combox, it shows "#NAME"

Please advice..
Thanks.
 
So if the control on the current form is a text box, it works, but if it is a
combo it doesn't work? That doesn't make sense. Do you have anything in the
Default Value property of the combo box? Does the combo box work correctly
if you don't set the Default Value from the Load event?
 
Back
Top