Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / February 2007

Tip: Looking for answers? Try searching our database.

After update Not update Text Field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 21 Feb 2007 16:49 GMT
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
destinman - 21 Feb 2007 20:39 GMT
>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
[quoted text clipped - 8 lines]
>
>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")
John - 22 Feb 2007 17:19 GMT
> >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
[quoted text clipped - 13 lines]
> Product_Price=DLookUp("Product_Price","ProductTableName","Product_Name=Name
> of the field you used for the dropdown")
Ron2006 - 22 Feb 2007 21:23 GMT
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
John - 26 Feb 2007 10:38 GMT
The method suggested by access monster seemed to work. Just could not get
your method working Ron.  Thanks all the same

> Your original logic is almost correct. It is in the proper place BUT
>
[quoted text clipped - 10 lines]
>
> Ron
DubboPete - 26 Feb 2007 10:56 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.