
Help Writing a complex form's data to a table
Sub cmdAppend_Click()
Dim db as Database
Set db = CurrentDB
db.execute("INSERT INTO Target1 SELECT * FROM Source1 WHERE
[EmployeeName] = '" & me!employeename & "';")
db.execute("INSERT INTO Target2 SELECT * FROM Source2 WHERE....
etc..
You'll end up with three Insert queries. One for the main form, and one for
each subform.
You might also want to add code that confirms the choice prior to executing
the code. You know, an "Are you sure you want to do this?" prompt.
Hope that helps,
Michael Kucan
Quote:
>I have a main form with fields and 2 subforms. Some of the fields, such as
>EmployeeName are common to all 3.
>The forms are read-only, they are not data entry forms. They are based on
>different sql statments and have calculated fields.
>I want to code a procedure to a button that will wite the data in the form,
>including its 2 subforms, to a table.
>Can this be done? Can you offer a general code outline how? Thank you.