Text Box Default Error

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?
 
D

Dennis

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

RMires

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?
 
R

RMires

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?
 
D

Dennis

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?
 

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

Top