Form which filters records in a table > display in report

  • Thread starter Thread starter Martijn
  • Start date Start date
M

Martijn

Hello,

I'm trying to design a form in which to dates can be typed.
These dates are: startdate & endingdate (shortdate).
In a table (tblRecords) is some information stored like:
date, delay, ATAchapter, Sta ....
What I need is the following: A command so that the
startdate and endingdate, which are given in the form,
filters the records in the table and displaying them in a
report.
I don't know much about programming or access at all (it's
a trainee assignment) so if it contains code please tell
me how

(I'm sorry for my English but I hope you know what I mean.)

Best Regards,

Martijn
 
Create two unbound text boxes on your form, name them txtStartDate, txtEndDate.
Create a query like this:

SELECT * FROM MyTable WHERE theDate BETWEEN Forms.MyForm.txtStartDate
AND txtEndDate

Save this query and name it qryFilteredMyTable
Create a report and base it on this query. Note that you must open the
report only when the form is opened and dates are entered. To make sure
this condition is satisfied, set default txtStartDate and txtEndDate to
1/1/1900 and 1/1/2099, and create a command button that will open the
report from the form.

Good luck,
Pavel
 
Back
Top