trigger that will add a record to another table

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I have a table with our members information and a table
to our accounts recievable information. The accounts
recievable table will reference the members information
table. I want to add a record with just the primary key
from the members information table to the accounts
recievable table when the user clicks a button.
 
Dan said:
I have a table with our members information and a table
to our accounts recievable information. The accounts
recievable table will reference the members information
table. I want to add a record with just the primary key
from the members information table to the accounts
recievable table when the user clicks a button.

You can use code to build and execute an append query. It might look
like this:

Private Sub cmdAddToAR_Click()

Dim strSQL As String

strSQL = _
"INSERT INTO tblAccountsReceivable (MemberID) " & _
"VALUES(" & Me.MemberID & ")"

CurrentDb.Execute strSQL, dbFailOnError

End Sub

That assumes that MemberID is a numeric field. If it's text, you might
write this instead:

"VALUES('" & Me.MemberID & "')"
 
Back
Top