I need to write an append single record SQL statement in VABA and I have no idea how to do it. I have a button on my "Contract Data" form that the user clicks to save a record. When the user clicks the button I want the ID # (which is the primary key and an Autonumber) to append itself to my "Financial Data" table, thus creating a new record in the Financial Data form with the same primary key number. However, I only want the append query to append a single record - the record that was just created. Can someone please tell me how to write the code. Thanks!
Pertinent Info:
Table where data is coming from "Data"
Field where data is coming from "ID"
Table to append data to "Financial Data"
Field to append data to "Financial ID"
Private Sub SaveRecord_Click()
On Error GoTo SaveRecord_Click_Err
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunSQL NEED TO APPEND THE RECORD HERE
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
SaveRecord_Click_Exit:
Exit Sub
SaveRecord_Click_Err:
MsgBox Error$
Resume SaveRecord_Click_Exit
End Sub
Pertinent Info:
Table where data is coming from "Data"
Field where data is coming from "ID"
Table to append data to "Financial Data"
Field to append data to "Financial ID"
Private Sub SaveRecord_Click()
On Error GoTo SaveRecord_Click_Err
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunSQL NEED TO APPEND THE RECORD HERE
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
SaveRecord_Click_Exit:
Exit Sub
SaveRecord_Click_Err:
MsgBox Error$
Resume SaveRecord_Click_Exit
End Sub