Add records to table

S

Saturn

Hi!
Trying to add many records to a table triggered by a
button clicked on a form. The values for the fields will
be mostly hard coded, and a few fields on each record will
come from fields on the form. This is what was suggested
to me as an example to insert one record:

Private Sub CreateSystem_Click()
Dim newrec As String

newrec = "INSERT INTO Components (Components.Customer_ID,
Components.Component_ID, Components.Unit_Cost) VALUES
(40,266,3750)"
CurrentDb.Execute newrec
End Sub

I've tried many variations on this but I either get a
syntax error on the "INSERT INTO" statement, or it tells
me that the Components_ID field is invalid (both with and
without the "Components." prefix). Please provide a
possible solution to this approach or suggest another
approach. Thanks!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top