Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection box item changes the value of a textbox. 2

Status
Not open for further replies.

sknyppy

Programmer
May 14, 1999
137
US
Goal: User selects a item from a drop-down list of items, after selecting an item a textbox is populated with the price of the item.

I believe I need to use an OnChange event to execute a query to retrieve the price but I'm unsure of the sql
syntax in Access. Any examples would be appreciated.

I combed through several msgs that were close to what I need but no examples to play around with and use.

-------------------------------------
Tablename: ItemsAndMonthlyRates
Columns: ItemID, Item, MonthlyRate.
-------------------------------------

Thanks,
Dave
 
here is what I would do.

Create your Combo box and have both the item and Price (two columns)
Item in the first column and Price in the second one.
If you don't want the Price to show then make its column width 0"

Now in the after update event of the Combobox put this

Me!yourtextbox = me!Combo1.column(1) '0 is the first column

Also if the price is in a diiferent table you vcan click the 3 dots button and have 2 tables as the "Row Source"

OK

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
I don't understand what you mean by using two columns, could you explain a little more? Do I display both item and price inside combo box and hide the price?

~Dave
 
Yes. In the combo box's RowSource property you can select both fields from the Table or Query. Go to the Column Count property of the combo box and change it to 2. In the column width you would can put 1;0. This tells how wide each column will be when you pull down the combo box list. Column 2 will be zero units wide, making it invisible to the user. Now for each item in column one, the corresponding price is with it in column 2. In reference to the combo box column 2 is called ComboBoxName.Column(1) which as stated above is due to the Column property being zero based.

Hope that helps.

B-) ljprodev@yahoo.com
ProDev, MS Access Applications
 
Thanks that did the trick but another thorn popped up.
The user can have multiple items/prices, the first item added is ok. The second, third, etc... item/price changes all the existing prices to the last price. The items are ok just the price changes....

~Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top