G
Guest
I have a command button on a form that opens a query which verifies
information on the current record. Depending on the criteria that is met,
certain check box(s) are checked off. This works fine so I don't want to mess
with it too much.
However, because I need to verify hundreds of records this takes too much
time. Can I include some code in that command button to verify the current
record, then move to the next record, etc. until it reaches the last record
in the table and then it stops. I thought a loop would work but I don't know
how to work it into my code.
This is the command button code:
Private Sub cmdVerifyScrubbedSupplierName123_Click()
On Error GoTo Err_cmdVerifyScrubbedSupplierName123_Click
Dim stDocName As String
stDocName = "mcrVerifyScrubbedSupplierName123"
DoCmd.RunMacro stDocName
If DCount("*", "qryVerifyScrubbedSupplierName1") > 0 Then
Me.Name1Verified = True
Me.OnEPLSDB1 = True
Else
Me.Name1Verified = 1
Me.OnEPLSDB1 = 0
End If
If DCount("*", "qryVerifyScrubbedSupplierName2") > 0 Then
Me.Name2Verified = True
Me.OnEPLSDB2 = True
Else
Me.Name2Verified = 1
Me.OnEPLSDB2 = 0
End If
If DCount("*", "qryVerifyScrubbedSupplierName3") > 0 Then
Me.Name3Verified = True
Me.OnEPLSDB3 = True
Else
Me.Name3Verified = 1
Me.OnEPLSDB3 = 0
End If
Exit_cmdVerifyScrubbedSupplierName123_Cl:
Exit Sub
Err_cmdVerifyScrubbedSupplierName123_Click:
MsgBox Err.Description
Resume Exit_cmdVerifyScrubbedSupplierName123_Cl
Exit Sub
End Sub
Thank you!!
information on the current record. Depending on the criteria that is met,
certain check box(s) are checked off. This works fine so I don't want to mess
with it too much.
However, because I need to verify hundreds of records this takes too much
time. Can I include some code in that command button to verify the current
record, then move to the next record, etc. until it reaches the last record
in the table and then it stops. I thought a loop would work but I don't know
how to work it into my code.
This is the command button code:
Private Sub cmdVerifyScrubbedSupplierName123_Click()
On Error GoTo Err_cmdVerifyScrubbedSupplierName123_Click
Dim stDocName As String
stDocName = "mcrVerifyScrubbedSupplierName123"
DoCmd.RunMacro stDocName
If DCount("*", "qryVerifyScrubbedSupplierName1") > 0 Then
Me.Name1Verified = True
Me.OnEPLSDB1 = True
Else
Me.Name1Verified = 1
Me.OnEPLSDB1 = 0
End If
If DCount("*", "qryVerifyScrubbedSupplierName2") > 0 Then
Me.Name2Verified = True
Me.OnEPLSDB2 = True
Else
Me.Name2Verified = 1
Me.OnEPLSDB2 = 0
End If
If DCount("*", "qryVerifyScrubbedSupplierName3") > 0 Then
Me.Name3Verified = True
Me.OnEPLSDB3 = True
Else
Me.Name3Verified = 1
Me.OnEPLSDB3 = 0
End If
Exit_cmdVerifyScrubbedSupplierName123_Cl:
Exit Sub
Err_cmdVerifyScrubbedSupplierName123_Click:
MsgBox Err.Description
Resume Exit_cmdVerifyScrubbedSupplierName123_Cl
Exit Sub
End Sub
Thank you!!