Default to Record nearest todays date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with fields GameID (number) and GameDate (time/date). I want
to have a ComboBox on a form that defaults to the GameID of the record that
has the date that is next after today's date. Rarely will the record contain
a date that is actually today's date, but rather it will be a date in the
near future.

Thanks in advance for your help.

Sterling
 
I have a table with fields GameID (number) and GameDate (time/date). I want
to have a ComboBox on a form that defaults to the GameID of the record that
has the date that is next after today's date. Rarely will the record contain
a date that is actually today's date, but rather it will be a date in the
near future.

Thanks in advance for your help.

Sterling

Set the DefaultValue property of the combo box to

=DMin("[datefield]", "[yourtablename]", "[datefield] >= #" & Date() &
"#")


John W. Vinson[MVP]
 
Thanks John. That was a huge help. The only modifiaction I had to make was
the first expression in the DMin statement should have been my [idfield]
rather than [datefield]. So my statement ended up being

=DMin("[gameid]", "[mytable]", "[gamedate] >= #" & Date() & > "#")


John Vinson said:
I have a table with fields GameID (number) and GameDate (time/date). I want
to have a ComboBox on a form that defaults to the GameID of the record that
has the date that is next after today's date. Rarely will the record contain
a date that is actually today's date, but rather it will be a date in the
near future.

Thanks in advance for your help.

Sterling

Set the DefaultValue property of the combo box to

=DMin("[datefield]", "[yourtablename]", "[datefield] >= #" & Date() &
"#")


John W. Vinson[MVP]
 
Back
Top