J
jpgoossen via AccessMonster.com
Hi,
I am having a hard time fool-proofing a form HOURS_ENTER.
The form is used to register hours worked by temporary employees in a table
called HOURS. First I select the employee through a combobox Select_Emp from
the table EMPLOYEES and store the EMP_ID into a field in the table. As a
visual check, I read the values for name, contract dates (BEGINDATE and
ENDDATE, for which the latter can be open, read empty) and such from the
table EMPLOYEES. Those values are, of course, not stored in HOURS, just the
ID.
Next I use a combobox Select_Week to select the week that they did their work
in. For this I have setup a large table WEEKS with all weeknumber (and dates
that comprise those weeknumbers) for the next 10 years. Of course, There is a
unique WEEKID field, next to the fields WEEKNUMBER (starts anew every year)
and WEEK_FROM and WEEK_TIL. Those last two fields contain the start and end
dates of the week in question.
Now, what I want to do is, only show the weeks/weeknumbers in my Combobox
Select_Week that fall within the period that the Contract with the employee
was in. So, can I constrain the values shown in my combobox to the date
range/weeknumbers that fall within the dates starting with BEGINDATE and up
until either the end of my table WEEKS or the week after the date in ENDDATE?
I have tried setting up a new Query for the ComboBox Select_Week with the
following expression:
SELECT WEEKS.IDWEEK, WEEKS.WEEKNUMBER, WEEKS.WEEK_FROM, WEEKS.WEEK_TIL
FROM WEEKS
WHERE (((WEEKS.WEEK_FROM)<Forms.HOURS_ENTER.Enddate) And ((WEEKS.WEEK_TIL)
ORDER BY WEEKS.IDWEEK;
I tried to check for empty values in the Enddate field, but for now, having
the correct Begindate would be of help already.
The question is the following. Whatever I try, the ComboBox Select_Week stays
empty, not even showing the Column Headers from the Query. What am I doing
wrong here? I also tried creating a SQL statement in AfterUpdate for the
Select_Emp Combobox, but this failed with an error message concerning invalid
WHERE statements.
I am at a loss here and would appreciate any insight or help.
TIA,
Patrick
I am having a hard time fool-proofing a form HOURS_ENTER.
The form is used to register hours worked by temporary employees in a table
called HOURS. First I select the employee through a combobox Select_Emp from
the table EMPLOYEES and store the EMP_ID into a field in the table. As a
visual check, I read the values for name, contract dates (BEGINDATE and
ENDDATE, for which the latter can be open, read empty) and such from the
table EMPLOYEES. Those values are, of course, not stored in HOURS, just the
ID.
Next I use a combobox Select_Week to select the week that they did their work
in. For this I have setup a large table WEEKS with all weeknumber (and dates
that comprise those weeknumbers) for the next 10 years. Of course, There is a
unique WEEKID field, next to the fields WEEKNUMBER (starts anew every year)
and WEEK_FROM and WEEK_TIL. Those last two fields contain the start and end
dates of the week in question.
Now, what I want to do is, only show the weeks/weeknumbers in my Combobox
Select_Week that fall within the period that the Contract with the employee
was in. So, can I constrain the values shown in my combobox to the date
range/weeknumbers that fall within the dates starting with BEGINDATE and up
until either the end of my table WEEKS or the week after the date in ENDDATE?
I have tried setting up a new Query for the ComboBox Select_Week with the
following expression:
SELECT WEEKS.IDWEEK, WEEKS.WEEKNUMBER, WEEKS.WEEK_FROM, WEEKS.WEEK_TIL
FROM WEEKS
WHERE (((WEEKS.WEEK_FROM)<Forms.HOURS_ENTER.Enddate) And ((WEEKS.WEEK_TIL)
[Begindate]))Forms.HOURS_ENTER.Begindate)) Or (((WEEKS.WEEK_TIL)>[Forms].[HOURS_ENTER].
ORDER BY WEEKS.IDWEEK;
I tried to check for empty values in the Enddate field, but for now, having
the correct Begindate would be of help already.
The question is the following. Whatever I try, the ComboBox Select_Week stays
empty, not even showing the Column Headers from the Query. What am I doing
wrong here? I also tried creating a SQL statement in AfterUpdate for the
Select_Emp Combobox, but this failed with an error message concerning invalid
WHERE statements.
I am at a loss here and would appreciate any insight or help.
TIA,
Patrick