Data from a form populating a table

  • Thread starter Thread starter carrie
  • Start date Start date
C

carrie

I have a form set-up with combo boxes from multiple tables. Once all of the
data is entered into the form I would like to press a button and have the
information from the form export into a separate table. Example: from a
combo box the person could choose the origin city (from a city table), choose
the origin state (from a state table), enter in a dollar amount (in a text
box). Once they have entered the information the user could click on a
button and have the data go into a different table. Does this make sense?
Can someone tell me how to make this work? Appreciate any help that I can
get.
Thanks
 
carrie said:
I have a form set-up with combo boxes from multiple tables. Once all of
the
data is entered into the form I would like to press a button and have the
information from the form export into a separate table. Example: from a
combo box the person could choose the origin city (from a city table),
choose
the origin state (from a state table), enter in a dollar amount (in a text
box). Once they have entered the information the user could click on a
button and have the data go into a different table. Does this make sense?
Can someone tell me how to make this work? Appreciate any help that I can
get.
Thanks

In the Click event of the button perform an INSERT action. Build the INSERT
statement by concatenating your values from the combo and text boxes.
Something like:

Dim strSQL As String
strSQL = "INSERT INTO
(field1,field2,field3...)"
strSQL = strSQL & " VALUES (" & cboBox1 & "," & cboBox2 & "," & txtBox3 &
")"
CurrentDb.Execute strSQL

You will need to watch for things like Null values in fields, because you
can't concatenate a Null value onto a string. Also, if your values are text
instead of numeric, you'll need to be sure to put quotes around the values
when you concatenate them.


Carl Rapson
 
Back
Top