access form button to copy record to another table

  • Thread starter Thread starter JMageeirbc
  • Start date Start date
J

JMageeirbc

I would like to use one form button to copy a record to another table
and then delete it from the current table. Is this possible?
 
This function will append fields F1, F2 from the current form into fields F1
and F2 in Table1.. and then delete the current record.

sub append_and_delete
Dim sql_string As String
sql_string = "INSERT INTO Table1 ( F1, F2 ) SELECT '" &
Me.Recordset.Fields("F1").Value & "','" & Me.Recordset.Fields("F2").Value &
"'"
Call DoCmd.RunSQL(sql_string)
Me.Recordset.Delete
end sub

enjoy
 

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

Back
Top