Enter Table/Query value in Form

G

Guest

I have an unbound text box on a form. I have a table with one field only (a
date field) that contains dates every two weeks (pay period ending date). I
want the text box on the form to show the current pay period ending date. I
have the following query SELECT First(Calendar.PeriodEndingDate) AS
EndingDateCurrent
FROM Calendar
WHERE (((Calendar.PeriodEndingDate)>Date()));
How do I get this single value returned by the query to be the default value
for the unbound text box on the form? Also, can the value be obtained on the
form without using the query to filter the value first?

Thanks,

Scott
 
G

Guest

If it is an unbound text box, put this in the Control Source of the text box:

=DLookup("[PeriodEndingDate]", "Calendar", "[PeriodEndingDate] > #" & Date()
& "#")
 
G

Guest

It worked perfect, thank you!

Klatuu said:
If it is an unbound text box, put this in the Control Source of the text box:

=DLookup("[PeriodEndingDate]", "Calendar", "[PeriodEndingDate] > #" & Date()
& "#")

Scott said:
I have an unbound text box on a form. I have a table with one field only (a
date field) that contains dates every two weeks (pay period ending date). I
want the text box on the form to show the current pay period ending date. I
have the following query SELECT First(Calendar.PeriodEndingDate) AS
EndingDateCurrent
FROM Calendar
WHERE (((Calendar.PeriodEndingDate)>Date()));
How do I get this single value returned by the query to be the default value
for the unbound text box on the form? Also, can the value be obtained on the
form without using the query to filter the value first?

Thanks,

Scott
 

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