Results 1 to 6 of 6
  1. #1
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62

    Exclamation Specific Code?

    I have created a database that deals with inventory control. My next step that I have been approaching is to click a command button that opens up a separate from but takes specific information from FORM 1 into the new FORM that I just created.



    So if a specific Employee takes out 4 aprons from a total of 50 and there are now 46 left, I would like the submit button to transfer that data over accordingly to Inventory control form in the correct text boxes.

    Specific Example: If employee John Doe takes 4 aprons from a total of 50 which now leaves 46 how can I transfer that data into the other form showing specific information like 'Product ID' taken, 'Date' it was taken, 'Product Description', 'Employee' who took it, 'Amount Taken' and, 'total' left.

    Is there a certain code that does this? Here are screen shots so you can get a visual

    Please Help....

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Using a few event procedures will solve your problem.

    However, I think VBA will be required.

  3. #3
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62
    What kind of event procedures exactly? And I am not to familiar with VBA anyway you can assist or guide me would be greatly appreciated..

  4. #4
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    At the simplest level, clicking the "Submit" button creates

    the Onclick event in your first form. That event procedure might simply open the second form.
    The second form's OnOpen event could make the first form invisible, if desired, and transfer information from the current record in the main form to the controls in the second form. When finished with the second form, the Onclose event could make visible the first form.
    Most of the BBA would be the transfer statements in the form of
    Form2![Field1] = Form1![Fieldx]
    Form2![Field2] = Form1![Fieldy] ........

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    I personally would not try to store the quantity on hand. It can be difficult to catch every possible way a user can affect the data. I would simply calculate it from transactions. Given your example, you have a transaction recording the receipt of 50 aprons and another transaction recording the taking of 4. It would be a simple query to net those out to 46. There's a discussion of the topic here, though Allen's code is more complicated than many situations require:

    http://allenbrowne.com/AppInventory.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    I've tried keeping a balance and operating from transactions.

    Operating from transactions is simpler within the Access framework, but I have a nagging fear that messing up a transaction will totally trash the inventory calculation. In any case it comes down to garbage in, garbage out.
    It is easy to become fixated on forms and forsake good database design. Take Paul's suggestion to heart, and reconsider your design.
    It can work either way.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Word code in Access - How to modify my current code
    By Alexandre Cote in forum Programming
    Replies: 0
    Last Post: 11-15-2010, 08:26 AM
  2. Code in combobox, code in text box
    By float in forum Forms
    Replies: 3
    Last Post: 09-29-2010, 07:12 AM
  3. Exporting only specific data
    By cypress in forum Access
    Replies: 1
    Last Post: 09-24-2010, 10:41 AM
  4. Code to pull in data from a specific record
    By jdunn36 in forum Access
    Replies: 1
    Last Post: 09-20-2010, 11:54 AM
  5. specific record
    By thewabit in forum Access
    Replies: 8
    Last Post: 02-17-2010, 11:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums