Calling TempVariable's value in an Append Query


access hacker1

I have a Transaction Tb and A Transaction Line Item Tb (TLI Tb). I'm using
an append query from another Table (Contract Tb's Form) to get info into both
the Transaction Tb and the TLI Tb so that I don't have to re-enter data. I
am trying to use a 2 step macro. The first step appends info into the
Transaction Tb creating a new record. In the 2nd step I need the primary key
from the last record of the Transaction Tb which was just created so that I
can use that ID in the TLI Tb. The Transaction Tb and TLI Tb are linked by
the Transaction Tb's primary key (TransctionID - TLITransactionID) . Can I
use a TempVariable calling the last record just created in the Transaction Tb
(using its TransactionID) and copy and paste it or insert it into the 2nd
append query into the TLI Tb. If so, how do I copy and paste in a macro or
copy and insert. I can't find anything in HELP about copying and pasting an
individual field's data within a macro. Any suggestions and possible code
would be greatly appreciated. Thank you.

Lord Kelvan

you could always modify your insert statement to use a select

insert into TLItb(TLItransactionid,field1,field2 ...)
select last(transactionid),"val1","val2" ...
from transactiontb

should work

that will bacially insert the last pk in transactiontb and any other
values you type in remember you dont have to actually select a value
from the table for it to display in the select query

hope that helps


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

Similar Threads