G
Guest
I have a form with a control that contains the following code:
========================================
Private Sub Invoice_AfterUpdate()
On Error GoTo InvoiceDone
V_Looper = True
DoCmd.GoToRecord , , acFirst
Me.IndividualRecordInvoice = Me.Invoice
Do While V_Looper = True
Me.IndividualRecordInvoice = Me.Invoice
DoCmd.GoToRecord , , acNext
Loop
InvoiceDone:
On Error GoTo ReceiptDateDone
V_Looper = True
DoCmd.GoToRecord , , acFirst
Me.IndividualRecordInvoiceReceiptDate = Me.ReceiptDate
Do While V_Looper = True
Me.IndividualRecordInvoiceReceiptDate = Me.ReceiptDate
DoCmd.GoToRecord , , acNext
Loop
ReceiptDateDone:
Me.InvoiceDate.SetFocus
End Sub
=================================================
The first do loop does what I wanted it to do, which is change all the
records on the form. [Invoice]
The second do loop errors on the "DoCmd.GoToRecord , , acNext" statement.
Run Time error 2105, " You cannot go to the specified record".
I would have thought that the " On Error GoTo ReceiptDateDone" line would
have taken care of it.
Does anyone have any idea why this would occur?
========================================
Private Sub Invoice_AfterUpdate()
On Error GoTo InvoiceDone
V_Looper = True
DoCmd.GoToRecord , , acFirst
Me.IndividualRecordInvoice = Me.Invoice
Do While V_Looper = True
Me.IndividualRecordInvoice = Me.Invoice
DoCmd.GoToRecord , , acNext
Loop
InvoiceDone:
On Error GoTo ReceiptDateDone
V_Looper = True
DoCmd.GoToRecord , , acFirst
Me.IndividualRecordInvoiceReceiptDate = Me.ReceiptDate
Do While V_Looper = True
Me.IndividualRecordInvoiceReceiptDate = Me.ReceiptDate
DoCmd.GoToRecord , , acNext
Loop
ReceiptDateDone:
Me.InvoiceDate.SetFocus
End Sub
=================================================
The first do loop does what I wanted it to do, which is change all the
records on the form. [Invoice]
The second do loop errors on the "DoCmd.GoToRecord , , acNext" statement.
Run Time error 2105, " You cannot go to the specified record".
I would have thought that the " On Error GoTo ReceiptDateDone" line would
have taken care of it.
Does anyone have any idea why this would occur?