good morning,
I have an unbound form. it has two controls, both of which are dates, [fromdate] and [todate]
the dates are used as the criteria for a query. the query is displayed in datasheet view (not on the form).
I currently have [fromdate] set with a hard coded default date #04/01/1850# which displays as 4 Jan 1850
what I want to do is change the default to the date of the earliest record in the database.
fortunately, this is already calculated in a query that is the source for a report, so the date I want is qry_eventcount2.start
if I enter this as the default value property of the control I get the #Name? error.
Googling this error I came across the following:
"typically, #Name? error occurs when the name of the control is a field in the recordsource, and controlsource begins with ="
since my form is unbound and neither edits nor enters data it has neither a recordsource nor a controlsource. so we have to pay attention to the word, "typically," at the beginning. which means, often, but not always.
so I look elsewhere for assistance and all the web pages I looked at describing the setting of a default value for a control use some form of the following?:
"The default value will appear in the control when you add a new record with the form."
they don't seem to consider that forms can be for things other than data entry. so I started to wonder whether it is even possible for an unbound control to have anything other than a hard coded default value. so I changed the default value property to =Date(), and that worked, it displayed today's date. but that comes from the computer rather than from the database.
so, my question is:
can a control on an unbound form have as its default value property data directly from the database, and if so, how do I do that?
many thanks,
Cottonshirt