Unfortunately, my skills with recordsets are little to none. I should make it a point to learn because I'm finding they are very powerful tools.
That said, can anyone help me with my next (and last) step in this project?
I now have a select query with results which look like this (I've simplified it a bit but for all intents and purposes, works the same):
ID Date Code Hours Name
1 2011-07-07 D 7.5 John
1 2011-07-08 D 7.5 John
1 2011-07-09 N 11.25 John
2 2011-07-07 D 7.5 Jane
2 2011-07-08 N 11.25 Jane
I can make a form where I enter a date range and select an employee, then have the query select those records meeting the criteria. However, I want to actually use a looped recordset to look at each record then copy to a temporary table. The temporary table would have the same column headings but the code and hours may differ. If you could help me set up the looped recordset to do this, I can put in the conditions. For example, it would look at the first line and see that the code is 'D' so nothing changes and it copies all fields the same. However, when it sees the 'N' code, it splits it into two rows: e.g.
ID Date Code Hours Name
1 2011-07-09 N 11.25 John
gets split into:
ID Date Code Hours Name
1 2011-07-09 E 4.00 John
1 2011-07-10 O 7.25 John
Then I generate a report based on the temporary table and finally clear the temporary table. Does this make sense?
That said, can anyone help me with my next (and last) step in this project?
I now have a select query with results which look like this (I've simplified it a bit but for all intents and purposes, works the same):
ID Date Code Hours Name
1 2011-07-07 D 7.5 John
1 2011-07-08 D 7.5 John
1 2011-07-09 N 11.25 John
2 2011-07-07 D 7.5 Jane
2 2011-07-08 N 11.25 Jane
I can make a form where I enter a date range and select an employee, then have the query select those records meeting the criteria. However, I want to actually use a looped recordset to look at each record then copy to a temporary table. The temporary table would have the same column headings but the code and hours may differ. If you could help me set up the looped recordset to do this, I can put in the conditions. For example, it would look at the first line and see that the code is 'D' so nothing changes and it copies all fields the same. However, when it sees the 'N' code, it splits it into two rows: e.g.
ID Date Code Hours Name
1 2011-07-09 N 11.25 John
gets split into:
ID Date Code Hours Name
1 2011-07-09 E 4.00 John
1 2011-07-10 O 7.25 John
Then I generate a report based on the temporary table and finally clear the temporary table. Does this make sense?