Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox Default Value Issue

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
I have a combobox on a form that is being populated from a query. When the form opens I want the combo box to show a certian value as default.

My combo box name is Combo4. MS Access help says to default to a seleced row use this in the Default Value property: [Combo4].[ItemData](0) Where the 0 indicates the first row. 1 would indicate the second row - etc.

This does not work. The combo box still shows blank when the form is opened.

Can anyone help?
 
try:

[combo]![itemdata].[0]

I think...

if that doesn't work, play about a bit with the ! and . Access can be very picky on how you place them at times...

--------------------
Procrastinate Now!
 
puforee,
open the properties of the combobox and under "Default Value" enter the row number of the "primary key value" of the value you want.
jim
 
xaf294

Jim, example please. I would like it to pick the PK of 1/1/2007. Can you provide this as an example?
 
Crowley16 - I have tried =[Combo4].ItemDate(0) as suggested by microsoft help. I tried your suggestion =[Combo4]![ItemDate](0). And I tried both with different variations of brackets or no brackets around ItemDate.

No go.
 
In the Load event procedure of the form:
Me!Combo4.SetFocus
Me!Combo4.ListIndex = 0

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV - I think we are close. One more way of asking my question.

I have a combo box with two columns. One column (the bound column) is start date. It is bound to field "Period start date" on the form.

I also have a "Period End Date" field on the form that I would like to be populated from the combo column(1) from the same combobox.

Both the start date field and the end date fields store data in a record in the bound table.

Maybe this is a little more clear...???!!!

Thanks for your patience
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top