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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot find rec in table xxx with key matching yyy?

Status
Not open for further replies.

jetspin

Programmer
Mar 5, 2002
76
Hi.

I have 2 tables. Items and Trans. Items be on Trans many times with a foreign key. I have a contunuous forms of Items which contains and EDIT button to open up a form of trans associated with the item of the edit button. I open of the trans form passin the foreign key. It lists all
the trans's for that Item, BUT when I try to add a new transaction I get an error "cannot find record in tblItems with key matching trnItmdID"....

The form was able to list all the Trans recs for the Item, why does the linking key get lost? How do I get around this?
Thank.s

tblItems
itmItmID

tblTrans
trnTrnID
trnItmID

 
How are you adding the new record? If you're doing it on a linked subform, it should work. If you're opening a trans form and adding a record, you'll have to use code to get the item ID into the trans record.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Hi.
Thanks for the reply. No I am not doing a linked subform
It is a continuous form. So when I go to add a new form, everything is null! I tried some code with no luck
on the "Before Update' event. I tried Me.trnItmID = Me.itmItmID with no luck. How do I do this? If I put itmItmID on the form, its a combox where the user could select the ITEM, but I want it to default on the ITEM which the trans are already listed for. Any help would be appreicated.
Vern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top