Combo box default value

H

Hank

I have a combo box with a drop down list of about 35 dates. Rather than
scroll to the proper date, I would like the drop down box to begin with a
date that is 7 days past the date in the previously selected field.
EXAMPLE: The date in the field above is 11-22-08. The drop down box would
have focus on 11-29-08. .

If that's not possible, my second choice would be to have the drop down box
begin with the date that is nearest to the current date.

Thanks
Hank
 
J

Jeff Boyce

Hank

Are you saying that you wish the default value in that control to be today's
date minus seven days? I believe you could use:

Date() - 7

in the default property.

Please note, however, that "default" only applies to new records, not
existing ones.

Please also note that a combobox may not be the most appropriate control to
use if you are using dates -- check out a textbox control.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
H

Hank

No,
What I need is to have the date in the drop down box to be focused on the
date that is nearest to today's date. There are about 30 dates in the combo
box. I'll look at a textbox control also.

Hank
 
C

Chegu Tom

Assuming that the dates in the list are both before and after today but you
want to have the closest
make a query of the dates I called the field in the table with the target
date DDate

SELECT DDate, abs(DDate-Date()) as dateSeq FROM yourtablewithdates ORDER BY
abs(DDate-Date())

The dates that are closest to today (before or after) will be at the top of
the list
 

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

Similar Threads


Top