Display Date Range on Form from Table

  • Thread starter Thread starter Geo
  • Start date Start date
G

Geo

Creating a form where I need to display the date range of a date field in a
table. I am trying to just use the min and max commands as part of a text
box referencing the table and field. When display the form I get #error
message. What I am doing wrong or not doing?
 
Geo,

Can't really say what you're doing wrong, since you didn't really say
what you're doing. :-)

You could use the DMax and DMin functions, in the Control Source of an
unbound textbox on your form, the equivalent of this:
=DMin("[YourDateField]","YourTable") & " to " &
DMax("[YourDateField]","YourTable")

Another approach would be to make a query based on your table, with the
equivalent of this entered in the Field row of the query design grid:
DateRange: Min([YourDateField]) & " to " & Max([YourDateField])

Then you could either include this query into the query that the form is
based on, whereupon you could have the [DateRange] field directly bound
to a control on the form. (Though in this case, this would probably mean
the data on the form would not be editable.) Or you could use the
DLookup function in the Control Source of the unbound textbox on your
form, the equivalent of this:
=DLookup("[DateRange]","YourQuery")
 
Back
Top