Calling TempVariable's value in an Append Query

  • Thread starter Thread starter access hacker1
  • Start date Start date
A

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.
 
you could always modify your insert statement to use a select
statement

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

regards
kelvan
 
Back
Top