Last Record Returned

  • Thread starter Thread starter Don Rountree
  • Start date Start date
D

Don Rountree

I am using Access 2000. I have a form with an unbound
field for entering a date. I'd like to be able to enter
a date and return the last record(s) entered before that
date. The date may not be the previous day or even the
previous month, but needs to be the last entered date
before the date entered into the unbound date field.
This is bigger than my feeble mind. Any help would be
appreciated. Thank...

Don Rountree
 
Don,

Create a query based on the table that contains the records you want. Pull down
the date field and all toher fields you want to return. For the date field enter
the criteria:
<Me!DateCriteria

Create a continuous form based on the query. In the form header add an unbound
textbox named DateCriteria. Put the following code in the AfterUpdate event of
the textbox:
Me.Requery

Put the following code in the Open event of the form:
Me!DateCriteria.SetFocus

Note: If you used "Date" for the name of a field in your table, you need to
change the name!! "Date" is an Access reserved word and using it for a field
name will eventually cause you problems.
 
Don,

I didn't read your post close enough!!

Also do this ---

In the query, set the sort on the date field to descending. Right click in the
query window and set the top values property to 1.
 

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

Back
Top