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")
 

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

Form to organize records by todays date 4
dates 6
Sort by date field 3
Listbox on form 2
Form - Two tables 4
Data Entry Form. 3
Dates 1
Can't get date to save in table.......... 6

Back
Top