Help Writing a complex form's data to a table 
Author Message
 Help Writing a complex form's data to a table

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.



Tue, 29 Oct 2002 03:00:00 GMT  
 Help Writing a complex form's data to a table
Also, one of the subforms is a continuous form format.
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.



Tue, 29 Oct 2002 03:00:00 GMT  
 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.



Tue, 29 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. performance of writing data writing into database tables

2. Accessing Table's Data from VBA code in form

3. Help with data writes and win '95

4. Writing my own 'data control'

5. Help - Can't Run Data Form Wizard

6. centralized data source and data tables for multiple form VB Application

7. ADO data control 'cannot find table'

8. DAO write operations don't make it to the tables

9. Can't write to VFP free tables

10. Can't write to VFP free tables

11. Writing table data to an existing spreadsheet

12. Writing Table Data Out To A File

 

 
Powered by phpBB® Forum Software