Autofill Raws

G

Guest

Autofill Raws
I have 2 tables in my database one is "Products" table and in this table here are the fields

ProdcutID ProductName UnitPrice Catagory Profit Production time in hours


and i have another table and it is "Order Details"

OrderDetailID OrderID ProductID UnitPrice Quantity Discount


In the Products table all information is entered there are all the products and the prices are entered too...When I fill an order for a customer I enter the Product ID an than I have to fill out the price in Order Detail table too...I want the price to be automatically taken from "Products" table when i enter the Product ID....

it must be easy but I don't know how to do it..in google i searched but i am beginner I couldnt understand...

Thanks a lot in advance
 
T

Tom Wickerath

The Northwind sample database includes an example of how to do this. Open the Orders form
and select a new product in the Orders subform. Then start reverse engineering this
example. You will find that the combo box named "ProductID" in the Orders subform
includes an After_Update event procedure (ie. VBA code) which inserts a looked-up price
into the UnitPrice control. That's one way of doing it. There are other ways as well.
For example, the row source of the ProductID combo box could include the price as a hidden
column. Then the After_Update event could populate the UnitPrice control by referring to
the correct column number for the hidden price column, which is zero based for a combo
box. That would eliminate the need of using the DLookup function.

Tom
____________________________________


Autofill Raws
I have 2 tables in my database one is "Products" table and in this table here are the
fields

ProdcutID ProductName UnitPrice Catagory Profit Production time in hours


and i have another table and it is "Order Details"

OrderDetailID OrderID ProductID UnitPrice Quantity Discount


In the Products table all information is entered there are all the products and the prices
are entered too...When I fill an order for a customer I enter the Product ID an than I
have to fill out the price in Order Detail table too...I want the price to be
automatically taken from "Products" table when i enter the Product ID....

it must be easy but I don't know how to do it..in google i searched but i am beginner I
couldnt understand...

Thanks a lot in advance
 

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