Updating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
thanks i did check the Northwind "order subform" that have some coding on it
so i can't follow that i really need something that i can easily understand
and learn .
thanks.

Allen Browne said:
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
 

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

Back
Top