Filter Microsoft Access Timesheets by Date Range and Billing Code
Question details
Filter timesheet records by a start date, end date, and billing code in an Access form.

- Product
- Microsoft Access and SQL Server
- Device & OS
- not provided
- Scenario
- An Access database uses a linked SQL Server table to display timesheet records on a form or report.
- Observed behavior
- The user wants to display only records matching the selected date range and billing code.
Confirm that the SQL Server table is linked in Access and identify the names and data types of its date and billing-code fields. The example uses tsdate and tsbcode; replace these and the table name if yours differ.
Use an Access parameter query to filter the timesheet form
Use this method when users need to enter a date range and select a billing code before opening matching records.
In Access, select Create > Form Design and save the unbound form as YourForm. Add two text boxes named FromDate and ToDate, then add a combo box named cboCode.
Select cboCode and open its Property Sheet. Set its Row Source to a table or query containing billing codes, and make sure its Bound Column returns a value compatible with the tsbcode field.
Select Create > Query Design, switch to SQL View, and enter: SELECT * FROM [YourLinkedTable] WHERE [tsdate] >= [Forms]![YourForm]![FromDate] AND [tsdate] < DateAdd("d", 1, [Forms]![YourForm]![ToDate]) AND [tsbcode] = [Forms]![YourForm]![cboCode]; Replace YourLinkedTable with the linked table name and save the query.
Open the results form or report in Design View and set its Record Source property to the saved query. On YourForm, add a button with the command button wizard to open that form or report.
Open YourForm, enter both dates, select a billing code, and click the button. Keep YourForm open so the query can read its controls.
Review exported timesheets in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Export Access results to Excel, then open them in WPS Spreadsheets to review and filter the data; WPS does not replace the Access parameter query or form.

Frequently Asked Questions
Why does Access ask me to enter a parameter value?
Check that YourForm is open and that the form and control names in SQL View exactly match the names in the form's Property Sheet. Also check the linked table and field names.
Does the date range include records from the end date?
Yes. The query uses tsdate < DateAdd("d", 1, ToDate), which includes records up to the end of the selected date even when tsdate contains a time.
Why are no records returned for the selected billing code?
Check cboCode's Row Source and Bound Column in the Property Sheet. The bound value must match the value and data type stored in tsbcode; also confirm that both dates and the selected code match existing records.
Can I open a report instead of a form with the filtered results?
Yes. Set the report's Record Source to the saved query, then use the command button wizard on YourForm to add a button that opens the report.




