Dates

  • Thread starter Thread starter Nancy
  • Start date Start date
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
 
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.
 
Back
Top