James Mckillop said:
I am pulling up 3 fields on a form from a query. I want to force the
text in these forms to write to another table on a button click. I
am looking for the syntax for this. Can anyone help?
You mean that you want to insert a record into a table with values from
the fields on your form? It might look something like this example:
'----- start of example code -----
Private Sub cmdCopyToTable_Click()
CurrentDb.Execute _
"INSERT INTO TargetTable " & _
"(Field1, Field2, Field3) " & _
"VALUES (" & _
'" & Me.Text1 & "', '" & _
'" & Me.Text2 & "', '" & _
'" & Me.Text3 & "')", _
dbFailOnError
' Note: the above assumes that these are all text fields,
' and that the values won't contain the single-quote
' character ('). This will need to be adjusted if the
' assumptions are false.
' Note: to use the dbFailOnError defined constant,
' you must have a reference set to the DAO Object
' Library.
End Sub
'----- end of example code -----