bustersports
Programmer
Thanks for reading and any suggestions you may have.
I have a form that will have anywhere from few hundred records, up to about 20,000. For some reason, it will not step through more than 564 records. In troubleshooting, I even put the max records to 500, close the form, and start again. It will then still max out at a total of 564 between opening the form twice. I have another very similar form, that will process all records with no problems. Below is my code for the NON-working form, below it is the correctly working form. Any suggestions as what may be causing the problem?
NON-Working Form
Private Sub cmdCalculatePayment_Click()
Dim X As Integer
Dim Y As Integer
Dim Z As Integer
Dim RecordCount As Boolean
DoCmd.GoToRecord , "", acFirst
Z = txtRecordsFound + 1
Y = Z - 1
For X = 1 To Y
If [Forms]![frmSelectChargeAccessorials].txtTotalRatesFoundAccessorial = 0 Then
Call NROF
Else
If txtCostBasis = "CostBasis" Then
Call CostBasis
Else
If txtCostBasis = "CPP" Then
Call WeightTimesRate
Else
If txtCostBasis = "CPK" Then
Call WeightTimesRate
Else
If txtCostBasis = "WeightTimesRate" Then
Call WeightTimesRate
Else
If txtCostBasis = "CWT" Then
Call CWT
Else
If txtCostBasis = "FlatCharge" Then
Call FlatCharge
Else
If txtCostBasis = "Container" Then
Call PerUnit
Else
If txtCostBasis = "HAWB" Then
Call PerUnit
Else
If txtCostBasis = "Per Container Per Day" Then
Call PerUnit
Else
If txtCostBasis = "PerDay" Then
Call PerUnit
Else
If txtCostBasis = "PerHour" Then
Call PerUnit
Else
If txtCostBasis = "Per KG Per Day" Then
Call PerUnit
Else
If txtCostBasis = "PerMonth" Then
Call PerUnit
Else
If txtCostBasis = "Per Mile" Then
Call PerUnit
Else
If txtCostBasis = "Per Shipment" Then
Call PerUnit
Else
If txtCostBasis = "Per Trip" Then
Call PerUnit
Else
If txtCostBasis = "PerUnit" Then
Call PerUnit
Else
If txtCostBasis = "Cost Per Cubic Meter" Then
Call PassThrough
Else
If txtCostBasis = "PassThrough" Then
Call PassThrough
Else
If txtCostBasis = "Percent" Then
Call PassThrough
Else
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
DoCmd.Hourglass True
DoCmd.GoToRecord , "", acNext
txtRecordsFound.Requery
Next X
DoCmd.Hourglass False
Requery
End Sub
Correctly Working
Dim X As Integer
Dim Y As Integer
Dim Z As Integer
Dim TariffNumber As Integer
[Forms]![frmSelectChargeFreight]![subfrmSelectChargeFreight4].Requery
TariffNumber = [Forms]![frmSelectChargeFreight].txtTariffNumber
DoCmd.GoToRecord , "", acFirst
Z = txtRecordsFound + 1
Y = Z - 1
For X = 1 To Y
[Forms]![frmSelectChargeFreight]![subfrmSelectChargeFreight5].Requery
[Forms]![frmSelectChargeFreight]![subfrmSelectChargeFreight4].Requery
[Forms]![frmSelectChargeFreight]![subfrmSelectChargeFreight5].Requery 'txtRatesFound
'txtRatesFound.Requery
If txtRatesFound = 0 Then
txtPostAuditComments = "NROF"
txtPostAuditRefund = Paid
optComplete = -1
optPostAuditClaim = -1
txtAdjCorrectAmt = 0
optComplete.SetFocus
cboReason = 5
Else
If TariffNumber = 1 Then 'Rate is cost basis
Call CostBasis
Else
If TariffNumber = 2 Then 'CPP or CPK, weight times rate
Call WeightTimesRate
Else
If TariffNumber = 3 Then 'Rate is CWT
Call CWT
Else
If TariffNumber = 4 Then 'Flat charge
Call FlatCharge
Else
If TariffNumber = 5 Then 'Per Unit (Per Hour, Per Month, Per Month, etc)
Call PerUnit
Else
If TariffNumber = 6 Then 'Pass Through or Percent or Cubic Meter
Call PerUnit
Else
End If
End If
End If
End If
End If
End If
End If
DoCmd.SetWarnings True
'txtRatesFound.Requery
txtNumberRatesFound = txtRatesFound
DoCmd.GoToRecord , "", acNext
'txtRecordsFound.Requery
Next X
DoCmd.Hourglass False
End Sub
I have a form that will have anywhere from few hundred records, up to about 20,000. For some reason, it will not step through more than 564 records. In troubleshooting, I even put the max records to 500, close the form, and start again. It will then still max out at a total of 564 between opening the form twice. I have another very similar form, that will process all records with no problems. Below is my code for the NON-working form, below it is the correctly working form. Any suggestions as what may be causing the problem?
NON-Working Form
Private Sub cmdCalculatePayment_Click()
Dim X As Integer
Dim Y As Integer
Dim Z As Integer
Dim RecordCount As Boolean
DoCmd.GoToRecord , "", acFirst
Z = txtRecordsFound + 1
Y = Z - 1
For X = 1 To Y
If [Forms]![frmSelectChargeAccessorials].txtTotalRatesFoundAccessorial = 0 Then
Call NROF
Else
If txtCostBasis = "CostBasis" Then
Call CostBasis
Else
If txtCostBasis = "CPP" Then
Call WeightTimesRate
Else
If txtCostBasis = "CPK" Then
Call WeightTimesRate
Else
If txtCostBasis = "WeightTimesRate" Then
Call WeightTimesRate
Else
If txtCostBasis = "CWT" Then
Call CWT
Else
If txtCostBasis = "FlatCharge" Then
Call FlatCharge
Else
If txtCostBasis = "Container" Then
Call PerUnit
Else
If txtCostBasis = "HAWB" Then
Call PerUnit
Else
If txtCostBasis = "Per Container Per Day" Then
Call PerUnit
Else
If txtCostBasis = "PerDay" Then
Call PerUnit
Else
If txtCostBasis = "PerHour" Then
Call PerUnit
Else
If txtCostBasis = "Per KG Per Day" Then
Call PerUnit
Else
If txtCostBasis = "PerMonth" Then
Call PerUnit
Else
If txtCostBasis = "Per Mile" Then
Call PerUnit
Else
If txtCostBasis = "Per Shipment" Then
Call PerUnit
Else
If txtCostBasis = "Per Trip" Then
Call PerUnit
Else
If txtCostBasis = "PerUnit" Then
Call PerUnit
Else
If txtCostBasis = "Cost Per Cubic Meter" Then
Call PassThrough
Else
If txtCostBasis = "PassThrough" Then
Call PassThrough
Else
If txtCostBasis = "Percent" Then
Call PassThrough
Else
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
DoCmd.Hourglass True
DoCmd.GoToRecord , "", acNext
txtRecordsFound.Requery
Next X
DoCmd.Hourglass False
Requery
End Sub
Correctly Working
Dim X As Integer
Dim Y As Integer
Dim Z As Integer
Dim TariffNumber As Integer
[Forms]![frmSelectChargeFreight]![subfrmSelectChargeFreight4].Requery
TariffNumber = [Forms]![frmSelectChargeFreight].txtTariffNumber
DoCmd.GoToRecord , "", acFirst
Z = txtRecordsFound + 1
Y = Z - 1
For X = 1 To Y
[Forms]![frmSelectChargeFreight]![subfrmSelectChargeFreight5].Requery
[Forms]![frmSelectChargeFreight]![subfrmSelectChargeFreight4].Requery
[Forms]![frmSelectChargeFreight]![subfrmSelectChargeFreight5].Requery 'txtRatesFound
'txtRatesFound.Requery
If txtRatesFound = 0 Then
txtPostAuditComments = "NROF"
txtPostAuditRefund = Paid
optComplete = -1
optPostAuditClaim = -1
txtAdjCorrectAmt = 0
optComplete.SetFocus
cboReason = 5
Else
If TariffNumber = 1 Then 'Rate is cost basis
Call CostBasis
Else
If TariffNumber = 2 Then 'CPP or CPK, weight times rate
Call WeightTimesRate
Else
If TariffNumber = 3 Then 'Rate is CWT
Call CWT
Else
If TariffNumber = 4 Then 'Flat charge
Call FlatCharge
Else
If TariffNumber = 5 Then 'Per Unit (Per Hour, Per Month, Per Month, etc)
Call PerUnit
Else
If TariffNumber = 6 Then 'Pass Through or Percent or Cubic Meter
Call PerUnit
Else
End If
End If
End If
End If
End If
End If
End If
DoCmd.SetWarnings True
'txtRatesFound.Requery
txtNumberRatesFound = txtRatesFound
DoCmd.GoToRecord , "", acNext
'txtRecordsFound.Requery
Next X
DoCmd.Hourglass False
End Sub