Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Microsoft Access 329    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Bug in Access 329 Code
Richard Rost 
      
16 years ago
Out of the hundreds of students who have taken this course, only ONE has found this bug - and it's a good one. If you RECEIVE parts from a vendor, the Quantity On Hand in the Products table is never updated! Here's the updated code for the button (PartsReceivedButton) that fixes the problem. Just replace all of the code in the button with this:


' --------------------------------------------------------

    If IsNull(POList) Then Exit Sub
    
    If MsgBox("Are you sure you want to mark this " & _
        "purchase order PARTS RECEIVED?", _
        vbYesNoCancel) <> vbYes Then Exit Sub
        
    ' --------- MISSING BEGIN -----------------------
    Dim db As Database
    Dim rs1 As Recordset, rs2 As Recordset
    Set db = CurrentDb()
    Set rs1 = db.OpenRecordset("SELECT * FROM PurchaseOrderDetailsT WHERE PurchaseOrderID=" & POList, dbOpenSnapshot)
    rs1.MoveFirst
    While Not rs1.EOF
        Set rs2 = db.OpenRecordset("SELECT * FROM ProductT WHERE ProductID=" & rs1!ProductID, dbOpenDynaset)
        rs2.Edit
        rs2!QtyOnHand = rs2!QtyOnHand + rs1!Quantity
        rs2.Update
        rs2.Close
        rs1.MoveNext
    Wend
    rs1.Close
    Set rs1 = Nothing
    Set rs2 = Nothing
    Set db = Nothing
    ' --------- MISSING END -------------------------
        
    Dim S As String
    S = "UPDATE PurchaseOrderT SET PartsReceived=TRUE " & _
        "WHERE PurchaseOrderID=" & POList
    DoCmd.RunSQL S
    
    BuildPOList

' --------------------------------------------------------


As you can see, everything between the "MISSING BEGIN" and "MISSING END" was just added by me. You need to create a Recordset loop to go through each item in the PODetails table and increase that product ID's quantity on hand.

I can't believe it has taken a year and a half for someone to catch this problem. This course was released in October of 2008. Wow.

Anyhow, thanks to Darl H. for catching this... and sorry it took me so long to post a solution.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Microsoft Access 329.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/9/2026 9:55:19 AM. PLT: 0s