So when the user selects an Item in your form, you want Access to look up
the current price for that item and fill it in for you?
Open the Northwind sample database that installs with Access.
Open the Orders Subform, in design view. Look at the code in the After
Update event procedure of the ProductID combo box. When the user selects a
product, it looks up the current price, and assigns the value to the
UnitPrice field. That's how it's done.
This presupposes you have a good set of relationships between the tables. In
Northwind, open the Relationships window (via the Tools menu.) You will need
tables similar to Northwinds for:
- Customers (who hires your stuff);
- Products (the stuff you hire);
- Orders (header record when stuff is hired);
- OrderDetails (the line items in a hiring.)
If you get stuck with the DLookup() part, here's a lead:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html
For an explanation of when and how to lookup a value and store it, see:
Calculated fields
at:
http://allenbrowne.com/casu-14.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Naveed Pathan said:
hiiiiii suppose i have two fields ( item , price)in a table and i want to
have a querry over that table if the the [item] have apple so i must have
20
in [price] and so on
i really need to solve that problem
though i have used "iif( ) but it can be used once while i need multiple
choices.
thanks