automatically add fields to a table?

buratti

Registered User.
Local time
Today, 01:00
Joined
Jul 8, 2009
Messages
234
Is it possible to, when I add a new record in one table/form, have Access automatically add and name 2-3 more fields to a different existing table?

For example: I have an employees table and an employee log table. The log table has one record for each work day and group of 2-3 fields in each record that relates to each employee (like work completed_1, hours_1, work completed_2... and so on). When I enter a new customer in the employees form, (lets say his employee id is 12) I want to have it automatically add 2 fields in the log table labeled work completed_12 and hours_12... then 13, 13 for the next employee, and so on. Can this be done??? And if so how?
 
Yes it can be done; but I'm having trouble understanding why you wish to keep adding fields to an existing table, every time you add a new Customer. It speaks of poor DB design and planning, and it will very quickly make the DB very unwieldy.
 
Restructure your database so the log table has a separate record for each employee.
 
i suggest you to create a table with refence to day number not employees, coz in this case an employess whp didn;t come to work that day would normally have no logs in the log table, i mean by that to let the work table be as a logfile.., example..
Employee(ID, Name, Salary , Rank...etc)
WorkDays(ID, Date, Notes, ShiftManager,,,etc)
WorkingEmps(DayID, EmpID,Work,Hours,Extra,,,,etc) here you can see the log process hapens automatically and can store evry change so in a report or query set a parameter for showing the log for each filed, EmpID, or Day or even type of work
the idea of inserting automatic records in a table can be done by a trigger that runs an Append query each time to store the values..but this way you will have complete same 2 copies of a log file!
 

Users who are viewing this thread

Back
Top Bottom