D
David Portwood
I have a main table related 1-1 to another table. Whenever I enter a record
into the main table, I want a record in the other table as well. At present,
I have a form based on the first table. In the AfterInsert method, I use a
recordset variable to add a new record to the second table.
The above works, but I was wondering if I should be basing the form on a
query combining the two tables so I can enter data into both tables from
controls on the form. This might be faster and more reliable. I am concerned
about the possibility of leaving a record in the first table without a
record in the second - in case of network glitch, for instance.
And yes, I could have used one table for all. However, the data items in the
second table are grouped separately because they have a distinct, separate
use from the data items in the first table. Users can browse/edit the second
table without disturbing the first, which would seem a good thing in terms
of maximizing performance and minimizing network traffic.
Anyway, I tried basing the form on a query that combines the two tables and
adding some invisible controls for the second table's data to the form. When
I do this and try to enter data I get an error message "Cannot update the
control", referring to one of the invisible controls based on data from the
second table. I viewed the control's properties and it is enabled and not
locked. Is the query non-updateable in this circumstance?
What would y'all say is the best way to implement the scenario described
above? What I am doing now works, but I wonder if I am missing a possible
improvement.
Any comments would be appreciated. Thanks in advance.
David Portwood
into the main table, I want a record in the other table as well. At present,
I have a form based on the first table. In the AfterInsert method, I use a
recordset variable to add a new record to the second table.
The above works, but I was wondering if I should be basing the form on a
query combining the two tables so I can enter data into both tables from
controls on the form. This might be faster and more reliable. I am concerned
about the possibility of leaving a record in the first table without a
record in the second - in case of network glitch, for instance.
And yes, I could have used one table for all. However, the data items in the
second table are grouped separately because they have a distinct, separate
use from the data items in the first table. Users can browse/edit the second
table without disturbing the first, which would seem a good thing in terms
of maximizing performance and minimizing network traffic.
Anyway, I tried basing the form on a query that combines the two tables and
adding some invisible controls for the second table's data to the form. When
I do this and try to enter data I get an error message "Cannot update the
control", referring to one of the invisible controls based on data from the
second table. I viewed the control's properties and it is enabled and not
locked. Is the query non-updateable in this circumstance?
What would y'all say is the best way to implement the scenario described
above? What I am doing now works, but I wonder if I am missing a possible
improvement.
Any comments would be appreciated. Thanks in advance.
David Portwood