Not sure how to code a loop structure...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • damjanovic
    New Member
    • Jan 2009
    • 4

    Not sure how to code a loop structure...

    Hi all,

    I've got some code in a form (frmTimer) which checks another form (frmOrders) every 2 seconds to see if any new records have been added. If yes, then a MsgBox pops up on the admin's screen. I'd like to add some more similar code to frmTimer to check if a particular field (chkAcknowledge d) in frmOrders has been checked off, and if yes, issue a popup MsgBox. However - the caveat is that in this case I need to be able to identify the specific record for which the chkAcknowledged check box has been checked off, e.g. "The order for 51 widgets, Order ID 22 has been acknowledged".

    I'm considering doing it with a loop (perhaps For...Each) statement, where every 2 seconds frmTimer would loop through all the chkAcknowledged controls in frmOrders and check to see if chkAcknowledged .Value <> chkAcknowledged .OldValue.

    I've tried reading up on looping online but I'm still not sure how to code this...can someone point me the right way with an example please? Thanks.
  • RuralGuy
    Recognized Expert Contributor
    • Oct 2006
    • 375

    #2
    What mechanism will you use to keep from duplicating the pop up messages?

    Comment

    • damjanovic
      New Member
      • Jan 2009
      • 4

      #3
      The user who sees the popup message will click "OK" and it goes away. I'm not sure if that answers your question properly? A message should pop up when the chkAcknowledged control's value changes to True/-1. The code should be able to identify the record where the Acknowledged checkbox value changed.

      Comment

      • RuralGuy
        Recognized Expert Contributor
        • Oct 2006
        • 375

        #4
        It sounds to me as though your PopUp form will need to put up the additional PopUp. Once the record is saved, unless you have a duplicate table there is no histore of a field changing.

        Comment

        • RuralGuy
          Recognized Expert Contributor
          • Oct 2006
          • 375

          #5
          I guess you could have a Notification Table and make entries from the PopUp and then delete the entries when the Supervisor reviews them. Then you could watch the Notification Table from the Timer Form.

          Comment

          Working...