I'll share my latest quandary with you; perhaps someone might have an elegant bit of code that would make this work out as easily as I think it ought to be!
In my database, I have a form which, of course, enters data into its corresponding table. What I want to happen is that, if a user chooses, some of the data from this form is also entered into a second table. Ideally I'd do this with an action button, although a check box with an After Update event procedure would work just as well.
For example, if Form A has six fields, three of which are duplicated in Table B, I want to have a button in Form A which, if clicked, would bring up a form or subform with the information which the user has just entered into those three duplicate fields in Form A, and automatically append this information to the matching fields Table B as well as to Table A. I tried using the wizard to build an action button, but 'Add Data to another Table' didn't seem to be an option. I tried creating a check box and writing a similar code in the after update event to the one above; I wrote
and that didn't work; I also tried mapping the field to be duplicated more exactly, like this:
and that didn't work either.
If only the "Enforce Referential Integrity" option had not only options for "Cascade Update" and "Cascade Delete" but "Cascade Create" as well, this would be easier!
Any suggestions?
Thanks a lot,
Spherey
In my database, I have a form which, of course, enters data into its corresponding table. What I want to happen is that, if a user chooses, some of the data from this form is also entered into a second table. Ideally I'd do this with an action button, although a check box with an After Update event procedure would work just as well.
For example, if Form A has six fields, three of which are duplicated in Table B, I want to have a button in Form A which, if clicked, would bring up a form or subform with the information which the user has just entered into those three duplicate fields in Form A, and automatically append this information to the matching fields Table B as well as to Table A. I tried using the wizard to build an action button, but 'Add Data to another Table' didn't seem to be an option. I tried creating a check box and writing a similar code in the after update event to the one above; I wrote
Code:
If [Add to Table B] Then
[Tables]![Table B]![Field 1] = [Field 1]
Else
[Tables]![Table B]![Field 1] = Null
End If
Code:
If [Add to Table B] Then
[Tables]![Table B]![Field 1] = [Forms]![Form B`]![[Field 1]
Else
[Tables]![Table B]![Field 1] = Null
End If
If only the "Enforce Referential Integrity" option had not only options for "Cascade Update" and "Cascade Delete" but "Cascade Create" as well, this would be easier!
Any suggestions?
Thanks a lot,
Spherey