Log in

View Full Version : Solved: Combo default value



cath_hopes
11-13-2007, 08:02 AM
hello again!

I've a combo box on my form that comprises of 5 fields from a table including the primary key as the hidden field (column(0)).
Unless the form's 'New Record' option is selected I would like the combo box to default to the values for a particular primary key that already exists within my form.

In pseudo code I'd like the combo on form_load to:
display/ goto record where combo.column(0) = knownvalue

Thanks in advance!

cath_hopes
11-13-2007, 10:00 AM
I've found a solution (hurrah!):

If NewRecord then
Else
Me.Combo.Value = knownvalue
Me.Combo.Requery
End If

When I used the wizard to set up the combo in the first place it gave the option of which field to use to store an identifying value (Me.combo.value). The obvious one to use was the primary key and that equates with my knownvalue.