Link to home
Start Free TrialLog in
Avatar of mstoolmi
mstoolmiFlag for United States of America

asked on

Create a new record in one table that includes data from another table in Access 2007

I have a client table that is linked to a number of other tables that contain survey instruments.  On the client record form, I have buttons that connects to each survey and create a new record.  When the survey record is created, I would like the client_id field to be populated by same id from the client table record where the button was clicked.  I thought that the best way to handle it was to create a temporary variable and set it equal to the id in the client table, then create the new record in the survey table, and set the client_id field to the temporary variable.  

How do you set the client_id to the temporary variable?  Or is there another way to set the client_id field to the right id?
Avatar of als315
als315
Flag of Russian Federation image

You can set variable in field's On click event, but normally you don't need it. If you are adding new records with subform, you can set default value for this (client_id) field in subform equal to value of this field in main form.
" I have buttons that connects to each survey" - if you are adding records with code, you also can use value of this field (Me.client_id or something like it).
If you can upload your DB with dummy data, we can help more.
ASKER CERTIFIED SOLUTION
Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial