Okay, I bet this is something simple ... I'm running through a pair of loops and I want to show my progress as I go. The outer loop advances through the customer table, the inner loop advances through product classes. Each time I advance to a new customer, I set me!lblCustomer. Caption to be the customer ID, and each time I advance a product class I set me!lblClass.Cap tion to equal the product class. The trouble is, nothing shows in these captions until the very end, after I have displayed my "Done" message. However, if I use the debugger and stop in the loops, the captions display as they should.
I'd appreciate any comments or suggestions.
Jim
Here's my code. It doesn't matter whether grpActionType = 1, 2, or 3, it behaves the same way.
I'd appreciate any comments or suggestions.
Jim
Here's my code. It doesn't matter whether grpActionType = 1, 2, or 3, it behaves the same way.
Code:
DoCmd.Hourglass False
Me!lblCustomer.Visible = True
Me!lblClass.Visible = True
rstCustomers.MoveFirst
Do While Not rstCustomers.EOF
Me!lblCustomer.Caption = rstCustomers!strCustomerID
If Me!grpActionType = 1 Then ' deleting
rstProductClass.MoveFirst
Do While Not rstProductClass.EOF
strCriteria = "strCustomerID = """ & rstCustomers!strCustomerID & """ and strItemClass =""" & rstProductClass!strStringItem & """"
Me!lblClass.Caption = rstProductClass!strStringItem
Me!txtProgress = rstCustomers!strCustomerID & " " & rstProductClass!strStringItem
' Me.Refresh
rstSpecialPricing.FindFirst (strCriteria)
If Not rstSpecialPricing.NoMatch Then
rstSpecialPricing.Edit
rstSpecialPricing("ynRestricted") = False
rstSpecialPricing.Update
End If
rstProductClass.MoveNext
Loop
ElseIf Me!grpActionType = 2 Then 'copy
rstProductClass.MoveFirst
Do While Not rstProductClass.EOF
' strCriteria = "strCustomerID = """ & Me!cboFromAccount & """ AND strItemClass =""" & rstProductClass!strStringItem & """"
strCriteria = "strCustomerID = """ & Me!cboFromAccount & """"
Me!lblClass.Caption = rstProductClass!strStringItem
Me!txtProgress = rstCustomers!strCustomerID & " " & rstProductClass!strStringItem
'Me.Refresh
rstSpecialPricing.FindFirst (strCriteria)
If Not rstSpecialPricing.NoMatch Then
Dim ysnRestricted As Boolean
ysnRestricted = rstSpecialPricing!ynRestricted
strCriteria = "strCustomerID = """ & rstCustomers!strCustomerID & """ AND strItemClass =""" & rstProductClass!strStringItem & """"
rstSpecialPricing.FindFirst (strCriteria)
If Not rstSpecialPricing.NoMatch Then
rstSpecialPricing.Edit
rstSpecialPricing("ynRestricted") = ysnRestricted
rstSpecialPricing.Update
Else
rstSpecialPricing.AddNew
rstSpecialPricing("strCustomerID") = rstCustomers!strCustomerID
rstSpecialPricing("strItemClass") = rstProductClass!strStringItem
rstSpecialPricing("dtmBeginDate") = #1/1/2000#
rstSpecialPricing("dtmEndDate") = #12/31/2099#
rstSpecialPricing("ynRestricted") = ysnRestricted
rstSpecialPricing.Update
End If
End If
rstProductClass.MoveNext
Loop
ElseIf Me!grpActionType = 3 Then ' new restrictions
rstProductClass.MoveFirst
Do While Not rstProductClass.EOF
strCriteria = "strCustomerID = """ & rstCustomers!strCustomerID & """ & strItemClass =""" & rstProductClass!strStringItem & """"
Me!lblClass.Caption = rstProductClass!strStringItem
Me!txtProgress = rstCustomers!strCustomerID & " " & rstProductClass!strStringItem
'Me.Refresh
rstSpecialPricing.FindFirst (strCriteria)
If Not rstSpecialPricing.NoMatch Then
rstSpecialPricing.Edit
rstSpecialPricing("ynRestricted") = True
rstSpecialPricing.Update
Else
rstSpecialPricing.AddNew
rstSpecialPricing("strCustomerID") = rstCustomers!strCustomerID
rstSpecialPricing("strItemClass") = rstProductClass!strStringItem
rstSpecialPricing("dtmBeginDate") = #1/1/2000#
rstSpecialPricing("dtmEndDate") = #12/31/2099#
rstSpecialPricing("ynRestricted") = True
rstSpecialPricing.Update
End If
rstProductClass.MoveNext
Loop
End If
rstCustomers.MoveNext
Loop
rstCustomers.Close
rstSpecialPricing.Close
rstProductClass.Close
Set rstCustomers = Nothing
Set rstSpecialPricing = Nothing
Set rstproductionclass = Nothing
Set dbs = Nothing
vbresult = MsgBox("Done", vbOKOnly)
DoCmd.Hourglass False
Me!lblCustomer.Visible = False
Me!lblClass.Visible = False
Comment