Question : Updating a field based on a Combo Box in a DAP

I have a simple data Acces Page that has a couple of Combo Boxes. Everything is working fine on it, but I would like to make some improvements.

Let's say I have a Combo box of Company Names. When I select a company name, I would like another control that I have on my page to be update with a specific price (which is governed by the company selected).

So basically I want my tboPrice box to be updated with a value when I select something out of my cboCompany box.

I'm not very familiar with DAP's , but could I use something like the OnChange, or onAfterUpdate? If so how would I go about coding my page?

Answer : Updating a field based on a Combo Box in a DAP

You could use the AfterUpdate event of the cboCompany box to look up the value in the database and write the result to the tboPrice field.

However, if you want to select the price from a single table or view, you can also use the DLookup function as the data source of the tboPrice field. If memory serves me right the value in the tboPrice field should get updated automatically when the value in the combobox changes.

Use something like this:
=DLookup("price", "table_or_view_name", "company_id = " & Form![cboCompany])

Random Solutions  
 
programming4us programming4us