trigger that will add a record to another table

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.
 
D

Dirk Goldgar

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 & "')"
 

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