Default display in combox

G

Gary Schuldt

How do I get a default value displayed in an unbound combo-box?

When I open the form, I'd like to be able to set an item from my
RecordSource to be displayed. When I click a cmdOK on that form, I'd like
that "default" to be the value of the combobox if the user didn't select
something different.

Thanks.

Gary
 
M

Michael

Hi Gary!
I guess you'll have to use VBA for your form's onLoad event.
You must insert these lines of code between "Sub... and ....End Sub"
procedure called when the form is being loaded.
Me.Combo1.Value = Dlookup("[Name of a column]","[Name of the table]", "set
of certain conditions to retrieve the default value")
 
G

Gary Schuldt

Thanks, Michael!

My first application of the statement worked fine.

Gary

Michael said:
Hi Gary!
I guess you'll have to use VBA for your form's onLoad event.
You must insert these lines of code between "Sub... and ....End Sub"
procedure called when the form is being loaded.
Me.Combo1.Value = Dlookup("[Name of a column]","[Name of the table]", "set
of certain conditions to retrieve the default value")


Gary Schuldt said:
How do I get a default value displayed in an unbound combo-box?

When I open the form, I'd like to be able to set an item from my
RecordSource to be displayed. When I click a cmdOK on that form, I'd like
that "default" to be the value of the combobox if the user didn't select
something different.

Thanks.

Gary
 

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