By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,753 Members | 2,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,753 IT Pros & Developers. It's quick & easy.

Report date range as years in option group

P: 200
I have a listbox showing reports, and when a report is selected, criteria (dates, employee name, etc.) necessary to print that report become visible. For a few reports, I would like to have the ability to select a year range instead of txtDateFrom and txtDateTo. So to the after update procedure for the listbox I would need to add:

Look at all dates of injury for all employees to determine how many year's of checkboxes (2006, 2007, 2008, 2009) to make visible in the grpYearSelect option group. If there is an injury in a given year, then make that year's checkbox visible.

Injury dates are stored in TblEmployeeInjury in field DateOfInjury.

For other reports, I would like to have a group (grpRangeSelect) with LastMonth, LastQuarter, YearToDate along with a choice to select txtDateFrom and txtDateTo. for these reports, if a user chooses to use the grpRangeSelect then txtDateFrom and txtDateTo become invisible and vice versa.

Thanks again for all your help!
Mar 9 '09 #1
Share this Question
Share on Google+
3 Replies

Expert 5K+
P: 8,675
You can base a Recordset on the following SQL, and extract from it all the Employees who had injuries during Unique Years only:
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT tblEmployeeInjury.Emp_ID, Year([DateOfInjury]) AS YearOfInjury
  2. FROM tblEmployeeInjury;
Mar 9 '09 #2

P: 200
Thanks ADezii. I got the first bit working using your code so thanks for that.

Now for the second bit, allowing the user the option to select dates for the reports using a group (grpRangeSelect) so the following options are available: YearToDate, LastQuarter, LastMonth, etc.

Mar 9 '09 #3

P: 200
Omitted follow-up question
Mar 9 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.