Text Box Default Error

  • Thread starter Thread starter RMires
  • Start date Start date
R

RMires

I have a table tblOpeningInv that includes a list of dates. I have a query
qryOpenMax the selects the latest date of that table. I have a text box
ctlOpenFolio that is on a form frmEntry. I want to set the default value of
the text box to the latest date selected in the query.
I have

=[qryOpenMax]![MaxOfDate]

as the default of the text box. I get a #name? error as a result. Is this
something to do with the format of the date? Is this not the correct way to
use the result of a query as a default? Am I barking up the wrong tree
entirely?
 
Assuming this query has just 1 line and is only used to get the max date then
set your default value to

=DLookUp("MaxOfDate","qryOpenMax")
 
It gives me the same error. All formats are "Short Date". Is this a problem?

Dennis said:
Assuming this query has just 1 line and is only used to get the max date then
set your default value to

=DLookUp("MaxOfDate","qryOpenMax")

RMires said:
I have a table tblOpeningInv that includes a list of dates. I have a query
qryOpenMax the selects the latest date of that table. I have a text box
ctlOpenFolio that is on a form frmEntry. I want to set the default value of
the text box to the latest date selected in the query.
I have

=[qryOpenMax]![MaxOfDate]

as the default of the text box. I get a #name? error as a result. Is this
something to do with the format of the date? Is this not the correct way to
use the result of a query as a default? Am I barking up the wrong tree
entirely?
 
Correction...it worked. Can you tell me why the other did not?

Dennis said:
Assuming this query has just 1 line and is only used to get the max date then
set your default value to

=DLookUp("MaxOfDate","qryOpenMax")

RMires said:
I have a table tblOpeningInv that includes a list of dates. I have a query
qryOpenMax the selects the latest date of that table. I have a text box
ctlOpenFolio that is on a form frmEntry. I want to set the default value of
the text box to the latest date selected in the query.
I have

=[qryOpenMax]![MaxOfDate]

as the default of the text box. I get a #name? error as a result. Is this
something to do with the format of the date? Is this not the correct way to
use the result of a query as a default? Am I barking up the wrong tree
entirely?
 
The other did not work because you can't just reference information in
queries or tables when the query or table is not the record source for the
form. The function I used is part of Domain Aggregate functions. Lookup
Domain Aggregate functions in the help for more information.

RMires said:
Correction...it worked. Can you tell me why the other did not?

Dennis said:
Assuming this query has just 1 line and is only used to get the max date then
set your default value to

=DLookUp("MaxOfDate","qryOpenMax")

RMires said:
I have a table tblOpeningInv that includes a list of dates. I have a query
qryOpenMax the selects the latest date of that table. I have a text box
ctlOpenFolio that is on a form frmEntry. I want to set the default value of
the text box to the latest date selected in the query.
I have

=[qryOpenMax]![MaxOfDate]

as the default of the text box. I get a #name? error as a result. Is this
something to do with the format of the date? Is this not the correct way to
use the result of a query as a default? Am I barking up the wrong tree
entirely?
 
Back
Top