Dates

N

Nancy

I'm writing a program in Access 2000 and I would like to
have a combo box where the user can select a date that is
between fifteen days before the current date and 15 days
after the current date. I'm trying to write a query that
will do give me the dates from fifteen days before
current date to 15 days after the current date. Can this
be done? if so, how?

Thanks
 
F

Fredg

Nancy,
If you want the combo to return the 30 dates.

Set the Combo Box's RowSource Type to Value List.
Set the Columns Count to 1
Set the Bound Column to 1
Set the column Widths to 1"
Leave the RowSource blank.

In the forms Load event:

Dim intX As Integer
Dim strRowSource As String
For intX = 15 To -15 Step -1 ' To sort dates ascending
strRowSource = strRowSource & Date - intX & ","
Next intX
ComboName.RowSource = Left(strRowSource, Len(strRowSource) - 1)

When you open the form the combo will fill with the dates.
 

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