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

Need help making unit price automatically show in forms and tables.

Status
Not open for further replies.

lesa1969

Programmer
Jan 31, 2000
1
US
I am working on a database and what I want to do is this:<br>

I want to be able to click on a product in the Product column in a form or table and the price automatically show in the Unit Price column.<br>

<br>

I have searched and searched and cant seem to find a thing on it. can anyone help?
 
Well, if each record in tblProduct contains a field called Unit Price, you should be able to see this in a the table or form without even clicking. If they are not in the same table, you need to set a relationship between the tables that do have the related data in the database's relationship window. Then create a form that uses the appropriate fileds from each table. Again, no clicking needed. If this is not helping maybe you could give us a little more detail on your data tables and whatever form you've already built.
 
Do you mean you want to fill out an order form? i.e., choose a product from a combo and have the related price show up in the unit price column? <br>
<br>
If so, one answer is to add the price as a field in the rowsource of your product combo and then in the AfterUpdate event of the product combo, set the price field to the value of the price column in the product combo box. This method will allow you to manually override the price on your order form without changing the price in the product table.<br>
<br>
So, for example, let's say you have a combo called Product and a text box called Price on your form. If the rowsource of your Product combo has two columns (Product Name and Price), then in the AfterUpdate event of the Product combo, there would be a line of code that reads<br>
<br>
Me![Price] = Me![Product].Column(1)<br>
<br>
Note that columns in a rowsource are numbered consecutively from zero. That's why the price is in Column(1).<br>
<br>
Elizabeth's method will work if you always want to use the existing product price with no changes or if you want the price in the product table to change when you override it on the order form.<br>
<br>
Please ask again if the solutions aren't clear.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top