Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 12th, 2003, 12:58 PM
Registered User
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ywith Send a message via MSN to ywith
Default 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.
Old June 12th, 2003, 01:27 PM
Authorized User
Join Date: Jun 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts

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
Old June 12th, 2003, 11:42 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hi hope someone can help here!!! mike_remember ASP.NET 1.0 and 1.1 Professional 2 October 31st, 2006 09:14 AM
Hope to have a idea for designing this system nadee VB Databases Basics 3 February 24th, 2006 03:24 AM
I hope it could help for right-click Yahoa Javascript How-To 0 December 11th, 2005 02:58 PM
Boy I sure hope the code is better hesterloli Wrox Book Feedback 3 February 10th, 2004 10:56 AM
Hope if any one can provide some help RahilPatwa All Other Wrox Books 0 November 8th, 2003 01:31 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.