Update a Different Table Field From SFRM's Control AfterUpdate

A

Andy

Hi;

Using A2K.

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