Y
Yasir Usman
Let's say I have two tables A and B.
Structure for tables:
A is id, A1, A2
B is id, B1, B2, Aid where Aid is foreign key that one
can relate table A to table B
I would like to construct a form that enables users to
perform data entry in the following manner:
1. User 1 will first create a record in table A by
entering column A1 only. A simple form will do this where
the only column in the form is A1. No problems yet.
2. At a later date, User 2 will need to fill in the
following data as it pertains to the entity that User 1
entered:
- any combination of A2, B1, B2
Ideally the form would take the following shape:
A1 - non-editable (for identification only)
A2 - editable
B1 - editable
B2 - editable
I have problems creating a usable form for user 2 because
Aid is a foreign key on table B i.e. it does not yet
exist. With such a form user 2 cannot add any new data
unless they had explicitly gone to table B to generate a
record in table B and tied it to table A via the foreign
key. That is too much to ask of user 2.
My question is:
1. Does anyone know how I can create a trigger when a
user enters data in table A that automatically generates
a corresponding record in table B with an id, Aid
Or
2. Does anyone know how I could create a script that
generates records in table B with an id, Aid when User 2
loads their data entry form
Or
3. Any other ideas?
BTW, I am to a certain degree constrained to the current
dB schema
Structure for tables:
A is id, A1, A2
B is id, B1, B2, Aid where Aid is foreign key that one
can relate table A to table B
I would like to construct a form that enables users to
perform data entry in the following manner:
1. User 1 will first create a record in table A by
entering column A1 only. A simple form will do this where
the only column in the form is A1. No problems yet.
2. At a later date, User 2 will need to fill in the
following data as it pertains to the entity that User 1
entered:
- any combination of A2, B1, B2
Ideally the form would take the following shape:
A1 - non-editable (for identification only)
A2 - editable
B1 - editable
B2 - editable
I have problems creating a usable form for user 2 because
Aid is a foreign key on table B i.e. it does not yet
exist. With such a form user 2 cannot add any new data
unless they had explicitly gone to table B to generate a
record in table B and tied it to table A via the foreign
key. That is too much to ask of user 2.
My question is:
1. Does anyone know how I can create a trigger when a
user enters data in table A that automatically generates
a corresponding record in table B with an id, Aid
Or
2. Does anyone know how I could create a script that
generates records in table B with an id, Aid when User 2
loads their data entry form
Or
3. Any other ideas?
BTW, I am to a certain degree constrained to the current
dB schema