GrandMasterTuck
In need of medication
- Local time
- Today, 18:40
- Joined
- May 4, 2013
- Messages
- 129
[SOLVED] Updating a "Hire Count" with a Macro
Hi all... I have a database with two tables. I want to have a macro run when I set a certain value on a new record in one of the tables, and I want the macro to update a value in the other table by increasing it one. The tables are linked via EmployeeName, and referential integrity is enabled.
tblEmployees: [EmployeeName][Count]
tblAssignments: [EmployeeName][AssignmentDate]
Hi all... I have a database with two tables. I want to have a macro run when I set a certain value on a new record in one of the tables, and I want the macro to update a value in the other table by increasing it one. The tables are linked via EmployeeName, and referential integrity is enabled.
tblEmployees: [EmployeeName][Count]
tblAssignments: [EmployeeName][AssignmentDate]
Code:
I have a query that shows me the employees, but sorted by Count (low to high), and I use a continuous form to display them. When I double-click a record on this form (one of the names), it adds a record to tblAssignments for that person, and writes today's date to the AssignmentDate column. I then pick a Code from an embedded drop-down list. Here's what i want to do:
Every time a code "QR" is set in tblAssignments, that runs a macro to go to tblEmployees and add 1 to [Count] for that employee. But if any other code is selected, it does nothing.
I can't just use a query to count the number of records for various reasons too complicated to bore you with. I need to have that table column update when that code is selected, so that the records in tblAssignments keep updating the [Count] in tblEmployees over time, and so I can run a separate Macro to 'reset' the [Count] field to zeros without losing the records in tblAssignments.
Can anyone give me an idea on how to do it? I've tried several things, and none of them work (either that, or I've done each of the several things incorrectly).
Thanks a million!
Last edited: