Autoinsert

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 hour

and i have another table and it is "Order Details

OrderDetailID OrderID ProductID UnitPrice Quantity Discoun

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 advanc
 
F

fredg

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

You can use DLookUp for this IF YOU ARE USING A FORM (as you should)
for data entry.
As control source in an unbound control on the Order Entry form:

=DLookUp("[Price]","[ProductsTable]","[ProductID] = " &
Me![ProductID])
The above assumes the [ProductID] field is a Number datatype.

If [ProductID] is Text Datatype, use:
"[ProductID] = '" & Me![ProductID] & "'")
 

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