vicissitude
Registered User.
- Local time
- Today, 21:45
- Joined
- Feb 28, 2010
- Messages
- 92
I wonder if someone could help me with this.
I have 2 combo boxes on a form. One with Month and one with Year.
I am trying to get a query to look at the combo boxes and return values from a table and thus generate a report.
Table has amongst others, these fields; [Name], [StartDate], [LeaveDate], [Status]
I need the query to return values which:
1. Include persons who have a [StartDate] which is before or equal to the form combobox month and year (included within the combobox month)
2. Reject persons who have [LeaveDate] which is After combobox month/ year date but includes those who have a [LeaveDate] within the combobox month.
3. And if possible also include persons who have [Status]= Current. This however may interfere with a person being included in combobox month if [LeaveDate] is within that month, but useful if someone forgets to fill in [LeaveDate].
Where I am stuck is.... I have these query fields but i do not know how to combine them to get what I want. Do I use DateDiff? Do I subtract one from the other? Do I need to combine month and year first? format it into something access can recognise and then subtract one from other?.......
Query Field; StartDateYear: year([StartDate])
Query Field; StartDateMonth: Month([StartDate])
Query Field; LeaveDateYear: Year([LeaveDate])
Query Field; LeaveDateMonth: Month([LeaveDate])
These are my criteria pointing to form comboboxes (SelectMonth returns month number. year is 4 digit)
(NZ([Forms]![Training_Hours_Main].[SelectYear]))
(NZ([Forms]![Training_Hours_Main].[SelectMonth]))
Any help would be greatly appreciated.
I have 2 combo boxes on a form. One with Month and one with Year.
I am trying to get a query to look at the combo boxes and return values from a table and thus generate a report.
Table has amongst others, these fields; [Name], [StartDate], [LeaveDate], [Status]
I need the query to return values which:
1. Include persons who have a [StartDate] which is before or equal to the form combobox month and year (included within the combobox month)
2. Reject persons who have [LeaveDate] which is After combobox month/ year date but includes those who have a [LeaveDate] within the combobox month.
3. And if possible also include persons who have [Status]= Current. This however may interfere with a person being included in combobox month if [LeaveDate] is within that month, but useful if someone forgets to fill in [LeaveDate].
Where I am stuck is.... I have these query fields but i do not know how to combine them to get what I want. Do I use DateDiff? Do I subtract one from the other? Do I need to combine month and year first? format it into something access can recognise and then subtract one from other?.......
Query Field; StartDateYear: year([StartDate])
Query Field; StartDateMonth: Month([StartDate])
Query Field; LeaveDateYear: Year([LeaveDate])
Query Field; LeaveDateMonth: Month([LeaveDate])
These are my criteria pointing to form comboboxes (SelectMonth returns month number. year is 4 digit)
(NZ([Forms]![Training_Hours_Main].[SelectYear]))
(NZ([Forms]![Training_Hours_Main].[SelectMonth]))
Any help would be greatly appreciated.
Last edited: