Help with subform values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crazytegger
    New Member
    • May 2006
    • 22

    Help with subform values

    Hi, I'm having a problem checking fields in my subform. On the main form there is a save button. The subform is a continuous form of items with an item quantity field. I want the save button to look if any items have a quantity of 0. The code I have works fine if I have only one item with a quantity of 0, or multiple items all with 0 for the quantity. However if I have two items, one with a qty>0 and one with a qty=0 it doesnt display the message. What do I need to do to check each individual qty value rather than the sum of all of them?

    Code:
    If Me.OrderDetailSubform.Form.itemqty = 0 Then
            If MsgBox(strMsg, vbOKCancel, "Warning!") = vbOK Then
                DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
                Call LockOrder
                Exit Sub
            Else
                Exit Sub
    End If
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32656

    #2
    You would need to move the recordpointer across all the records of your subform in a loop.
    Within the loop do the checking of each record to match the logic you're trying to implement.

    Comment

    Working...