p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   some questions - hope someone can help (http://p2p.wrox.com/showthread.php?t=509)

ywith June 12th, 2003 12:58 PM

some questions - hope someone can help
I've got a couple of questions to ask for a project i'm doing for school, i hope someone can help.

1. I'm creating a inventory system, and like stock re-ordering. I've got a table with a list of products and this information is shown in a form. I have a product form with a record for each product you can have. I want to be able to click a button and the product number (autonumber for the product and the primary key) is selected in another table ready for making a re-order. So basically say i was on the record for bannanas, i would then click a button, and the form for purchasing would pop up and in the drop down box for the product i want to purchase i would like bannanas selected. So i want the value of the drop down box to be the same as the record i was viewing. Is there any way to do this in a macro.

2. How is it possible in a drop down box to have two fields shown next to each other. Because i got like a drop down box, which is the primary key, but all that is is (1,2,3,4,5...) rather than like (apples, bannanas, oranges....etc). So could i like select the bannnas word, and then it update a text box or sumthing with the relevant product number?

3. I want to have a table with the amount of each product in stock. Would it be possible to have a form where i type in a amount to be re-odered, and that field be updated by adding the value i've just entered to the current value so basically adding the new products to the current amount of products in stock.

I'd be very appreciative if you could help.

any other suggestions would be welcomed too.

shepston June 12th, 2003 01:27 PM

1. The best way to handle this problem would be to write a sub that would trigger the ordering form to open and set the value of your given combo box to the product from the first form:


Private Sub cmdOrderButton_Click()

    DoCmd.OpenForm "frmProductOrder", acNormal, , "productName='" & txtProduct & "'"
    Forms!frmProductOrder.cmbProductName.Value = "Bananas"

End Sub

Where frmProductOrder is the product order form and cmbProductName is the name of your combo box or drop down list.

2. Set the RowSource property for your combo box using an SQL statement:


RowSource = "SELECT tblProductInfo.productID, tblProductInfo.productName FROM tblProductInfo;
Where tblProductInfo is the table that contains the product information.

3. The best way to do this would be to use Recordset to update the table that contains the quantities that are in stock. But it might be easier to have both forms open and have the reorder form update the value in stock form if you are not familiar with Recordsets.

Hope that helps!

[edit] Typos

-Shay Shepston

Steven June 12th, 2003 11:42 PM

For Shay's suggestion in 2. to work, you'll also have to remember to set the Column Count to 2 - I assume Shay took it for granted - but just thought I'd point this out :)


There are 10 kinds of people in the world - those who understand binary - and those with friends

All times are GMT -4. The time now is 06:06 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.