Working with 2 tables (tblLoans and tblLoanPayments) For every instance where a loan is past due (tblLoans) I need to post a late charge in the tblLoanPayments
Dim tblLoans As DAO.Recordset Dim rs As DAO.Recordset Dim lRecCount As Long, i as integer, ii as integer Dim HowmanytimesLate as integer, late lRecCount = DCount("*", "tblLoans") DoCmd.GoToRecord , , acFirst late = True '... for illustration HowmanytimesLate = 5 '...for illustration
For i = 1 To lRecCount If late For ii to howmanytimeslate 'I run this DoCmd.RunSQL "INSERT INTO tblLoanPayments (LoanNo,...... 'Or this ---but not both 'DoCmd.OpenForm "frmAssessLateFeeRecording"... Next ii DoCmd.GoToRecord , , acNext - I get error right here Next i
Problem is that when the DoCmd.RunSQL "INSERT INTO tblLoanPayments OR theDoCmd.OpenForm "frmAssessLateFeeRecording"... to record a transaction on tblLoanPayments and comes back here, I get error going to next record.
The error: Run-time error '2499': You can't use the GoToRecord or SearchForRecord action or method on an object in design view --- but am not in design - and again... if I don't run the DoCmd to write the transaction, it all works perfectly, makes its calculation and updates the table loans properly
several steps were omitted afraid I would hit limit of 2000 characters, but I think the idea is there, hope it makes sense...
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visitor Forum.