Results 1 to 9 of 9
  1. #1
    jpl85716 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    8

    Northwind Inventory Error

    I have an error when I enter a order for items that are in stock but I get an error " Item Not Found in this Collection (3265) Quantity_AfterUpdate. Thanks for any Help.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It would help to see your actual code and the line that errors. The error implies that you're referring to an object or method that doesn't exist.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jpl85716 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    8
    Quote Originally Posted by pbaldy View Post
    It would help to see your actual code and the line that errors. The error implies that you're referring to an object or method that doesn't exist.
    I think this is what you're asking for, If not please let me know.

    Private Sub Quantity_AfterUpdate()
    On Error GoTo ErrorHandler

    Dim IT As InventoryTransaction
    Dim PurchaseOrderID As Long
    Dim SupplierID As Long

    IT.ProductID = Nz(Me![Product ID], 0)
    IT.Quantity = Me![Quantity]
    IT.AllOrNothing = True
    IT.InventoryID = Nz(Me![Inventory ID], NewInventoryID)

    'Request Hold on specified Inventory
    If Inventory.RequestHold(Me![Order ID], IT) Then
    Me![Inventory ID] = IT.InventoryID
    Me![Status ID] = OnHold_OrderItemStatus

    'Insufficient Inventory
    ElseIf Me![Status ID] <> None_OrderItemStatus And Me![Status ID] <> NoStock_OrderItemStatus Then
    MsgBoxOKOnly InsufficientInventory
    Me![Quantity] = Me.Quantity.OldValue

    'Attempt to create purchase order for back ordered items
    ElseIf MsgBoxYesNo(NoInventoryCreatePO) Then

    SupplierID = Inventory.FindProductSupplier(IT.ProductID)

    'Create purchase order if we have supplier for this product
    If SupplierID > 0 Then
    If PurchaseOrders.Generate(SupplierID, IT.ProductID, Me![Quantity], Me![Order ID], PurchaseOrderID) Then
    PurchaseOrders.OpenOrder PurchaseOrderID
    Me![Status ID] = OnOrder_OrderItemStatus
    Me![Purchase Order ID] = PurchaseOrderID
    eh.TryToSaveRecord
    Else
    Me![Status ID] = NoStock_OrderItemStatus
    End If

    'Could not find a supplier for this product
    Else
    MsgBoxOKOnly CannotCreatePO_NoSupplier
    Me![Status ID] = NoStock_OrderItemStatus
    End If

    Else
    Me![Status ID] = NoStock_OrderItemStatus
    End If

    Done:
    Exit Sub

    ErrorHandler:
    ' Resume statement will be hit when debugging
    If eh.LogError("Quantity_AfterUpdate") Then Resume
    End Sub

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    another thing that might have happened is that you dimmed a variable incorrectly. e.g. - you used this code:
    Code:
    dim cbo as combobox
     
    set cbo = me.textbox

  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,521
    Temporarily comment out this line:

    On Error GoTo ErrorHandler

    and run the code. When it errors you will be allowed to go into debug mode and see exactly what line is throwing the error.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    jpl85716 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    8
    Quote Originally Posted by pbaldy View Post
    Temporarily comment out this line:

    On Error GoTo ErrorHandler

    and run the code. When it errors you will be allowed to go into debug mode and see exactly what line is throwing the error.
    where would I insert that line at ?
    This is what comes up on VB "Debug.Assert False ' Stop code so that you can debug"

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You wouldn't insert it, it's already there. If you delete it or comment it out, the code will go to the offending line when it errors. With that line in there, code just runs to the error trap and you're not sure what line is causing it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    jpl85716 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    8
    Quote Originally Posted by pbaldy View Post
    You wouldn't insert it, it's already there. If you delete it or comment it out, the code will go to the offending line when it errors. With that line in there, code just runs to the error trap and you're not sure what line is causing it.
    That worked thank you for your help .

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Northwind Traders Quantity After_Update
    By PaulieC in forum Programming
    Replies: 1
    Last Post: 02-06-2012, 02:47 PM
  2. Help with Database from Northwind
    By jpl85716 in forum Access
    Replies: 2
    Last Post: 09-24-2010, 08:35 AM
  3. Microsoft's Northwind database example
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 08:52 PM
  4. Where can I get Northwind db?
    By RedGoneWILD in forum Access
    Replies: 2
    Last Post: 07-08-2010, 11:28 AM
  5. Northwind
    By Lghtning4u in forum Access
    Replies: 1
    Last Post: 06-12-2010, 05:58 AM

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