combo box

G

Guest

ok i have a table "products" that has "quantity" field. i also have a form
that takes data from "order" and "order detail" tables. now when i open the
form i chose for example the customer and that is taken from the customers
table and then automatically it will fill the address and info about the
customer. now the part i have question on is that when the i choose which
items the customer to buy i want in the quantity combo box to display for
example (1-10) if the product they have chosen which was taken from products
table has a quantity of 10. also after submit i want the product table to be
updated to equal the number - the sold.
 
D

Duane Hookom

Your product should be selected from a combo box with columns like:

SELECT ProductID, Product, QtyOnHand
FROM tblProducts
WHERE QtyOnHand > 0
ORDER BY Product;

Then, in the after update event of the product combo box, you can add code
like:

Dim intI as Integer
Dim strQtys as String
For intI = 1 to Me.cboProduct.Column(2)
strQtys = strQtys & intI & ";"
Next
strQtys = Left(strQtys,Len(strQtys)-2)
Me.cboQuantity.RowSourceType = "Value List"
Me.cboQuantity.RowSource = strQtys
 

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