After update Not update Text Field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a subform based on a table. Within that table there is a
product name field which retrives a list of product names and prices from the
Products table. I to use the subform to enter product and then get it to
automatically update the price field.

I have read many entries about using after update to do this, but I just can
not get it to work. I select the product in the drop down and nothing
happens. I am pulling my hair out. The code I used was

Me.Product_Price = Me.Product_Name.Column(2)

Can any one help me
 
John said:
I have created a subform based on a table. Within that table there is a
product name field which retrives a list of product names and prices from the
Products table. I to use the subform to enter product and then get it to
automatically update the price field.

I have read many entries about using after update to do this, but I just can
not get it to work. I select the product in the drop down and nothing
happens. I am pulling my hair out. The code I used was

Me.Product_Price = Me.Product_Name.Column(2)

Can any one help me



Try this : After UpDate

Product_Price=DLookUp("Product_Price","ProductTableName","Product_Name=Name
of the field you used for the dropdown")
 
destinman via AccessMonster.com said:
Try this : After UpDate

Product_Price=DLookUp("Product_Price","ProductTableName","Product_Name=Name
of the field you used for the dropdown")
 
Your original logic is almost correct. It is in the proper place BUT

The column numbers in combo boxes are based off of 0 not 1

So your original code is faster and better but should be:

Me.Product_Price = Me.Product_Name.Column(1)


The Dlookup will work but you are doing a whole extra query to get
something that you already have in the original query.


Column(1) is the second field in the combo query.

Ron
 
The method suggested by access monster seemed to work. Just could not get
your method working Ron. Thanks all the same
 
John,

try this code instead....

Product_Price = DLookUp("[ProductPrice]","ProductTableName","[Product_Name]
= [Forms]![FrmYourForm]![YourField]")

I hate DLookup, but manage to get by with this...

DubboPete
 

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

Back
Top