INSERT INTO statement from multiple forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

This is what I have: 6 forms that have 5 - 6 text boxes or combo boxes on
each form. These text boxes and combo boxes are currently Unbound but that
can change if needed. I also have one table (tbl_information).

This is what I want: I want the tbl_information to be populated after the
user enters information in all of the text boxes on all 6 forms. I want this
to happen at the click of a button on the 6th form.

I can use INSERT INTO and SELECT statements if I need to.
 
RatherBeeHome said:
Hi,

This is what I have: 6 forms that have 5 - 6 text boxes or combo boxes on
each form. These text boxes and combo boxes are currently Unbound but that
can change if needed. I also have one table (tbl_information).

This is what I want: I want the tbl_information to be populated after the
user enters information in all of the text boxes on all 6 forms. I want this
to happen at the click of a button on the 6th form.

I can use INSERT INTO and SELECT statements if I need to.

One way is to declare a recordset object in a sub on Form6 and then
set the contents of each field in the recordset in your code.

dim rs as dao.recordset
set
rs=dbengine(0)(0).openrecordset("SourceTable",dbOpenTable,dbappendonly)
rs.AddNew
rs.fields("SomeField")=Forms!OpenForm1!ControlName
rs.fields("AnotherField")=Forms!OpenForm2!ControlName
rs.fields("YetAnotherField")=Me.Controls("SomeControl").value
....
rs.Update
rs.close
set rs=nothing


creating a huge INSERT statement would be a huge PITA. Possible, sure,
but a serious hassle.
 
Back
Top