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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box

Status
Not open for further replies.

Vcscwi

Programmer
Jan 15, 2004
57
US
I'm trying to create a combo box that lists a series of dates, some before today and some after.

How do you set the row source of a combo box to be a series of functions?

For Example:
=DateAdd("m", 1, Date()); =DateAdd("m", 2, Date()); ...

I've tried setting the row source to value list and field list with no luck. Everytime I try MS Access wants to convert it to text.

Thanks!
 
Take a look at the RowSourceType property of the ComboBox object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have reviewed the Row Source Type property. I expect it needs to be a value list, but at I stated before I am not getting the results I want since MS Access is converting my functions to text.

Any guidance would be helpful.
 
Provided the RowSourceType property is properly set to Value list you may try something like this in the Load event procedure of the form:
With Me![name of the combo]
.Rowsource = ""
For i = -8 To 8
.RowSource = ";" & .RowSource & DateAdd("m", i, Date())
Next
.RowSource = Mid(.RowSource, 2)
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top