Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to pass information from an append query?

Status
Not open for further replies.

postermmxvicom

Programmer
Jun 25, 2007
114
US
I have an append query that adds one record. I have a form which calls that query. I would like to reference the record that is made by the append query.

Currently, I am using DLookUp to find the matching record, but this concerns me. What if my logic for the DLookUp gets broken by some unforseen possibility (since my knowlege of access is limited, the unforseen is pretty large). I would feel better if I could somehow get my append query to pass along the primary key of the record for use by other forms/queries.

The specific problem I am tackling right now is duplicating a record in a table and records linked to it in another table (with minor changes) - for new entries based off old entries.



One last thing: Sometimes I wonder; "Is that someone's signature? Or do they type that at the end of each post?
 
You can use @@identity, but this has similar perils to dlookup, in that someone could step in and create a record in the meantime, though the likelihood depends on the number of users. You can create your own number with various locks and safeguards, which would mean that you were quite certain of the number (see You can use a timestamp, which combined with the number should ensure you have the right one, for the most part. It all depend on how many people are using your database and how enthusiastically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top