Update / Delete Record in Un-Related Tbl

A

Andy

Hi;

Using A2K.

Had originally posted this as "Update a Different Table Field From SFRM's
Control AfterUpdate". (Below)

Think this Subject Line is more to the point: Update / Delete Record in
Un-Related Tbl.

Where can I find the answer to:

How do You Update or Delete a record in an Un-Related tbl using an sfrm's
event?

The event would Update the "Foriegn" tbl Fields when needed and Delete an
entire record or records in that tbl when needed.

Would someone be so kind and point me in the right direction?

Thank You for taking the time to read this post.

Andy


Original Post:

"Update a Different Table Field From SFRM's Control AfterUpdate"

Need to update a price in tblPackagedProducts when the price is changed in
sfrmProducts.

Just finished browsing more than 1500 post subjects. Nothing obvious to me.

Have 4 Tbls feeding 2 Frms.

frmProductCategory, Record Source = tblProductCategory
sfrmProductName, Record Source = tblProductName
sfrmProductName contains ProductName, ProductDescription, ProductCost,
ProductMarkup, ProductSellingPrice.

frmPackagedCategory, Record Source = tblPackagedCategory
sfrmPackagedProductName, Record Source = tblPackagedProductName
sfrmPackagedProductName contains PackagedProductName,
PackagedProductDescription, PackagedProductCost, PackagedProductMarkup,
PackagedProductSellingPrice.

The user enters products individually in frmProductCategory then in
frmPackagedCategory!sfrmPackagedProductName the user can cluster individual
products in a "Package". All this works correctly.

What the AfterUpdate Event in sfrmProductName![ProductCost] needs to do is
that when the user updates the Cost for a product in
frmProductCategory!sfrmProductName the updated Cost needs to be "Copied?"
into tblPackagedProductName![PackagedProductCost]
and same for ProductCost = PackagedProductMarkup & ProductSellingPrice =
PackagedProductSellingPrice.

Using this Code in AfterUpdate:
Dim X As Variant
X = DLookup("[PackagedProductName]", "tblPackagedProductName",
"[PackagedProductName]= '" _
&
Forms![frmProductCategory].Form![sfrmProductName].Form![txtProductName] &
"'")

If Not IsNull(X) Then

Above works correctly.

What doesn't work is this next snippet:
Tables![tblPackagedProductName].Table![PackagedProductCost] =
Me.Forms![frmProductCategory].Form![sfrmProductName].Form![txtProductCost]

Would someone be so kind and tell me what is missing?

Thank You for taking the time to read this Post.

Andy
 

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