Dataset Accept Changes causing crash

Hi
I have a calculation which I run against the rows of a datatable. The code below is run if the user picks the Count Policy option.
It runs fine if there are a thousand or so rows. However, over a certain number, this step will cause the program to crash.
I'm not sure exactly where in the procedure is causing the crash, but I do know that the report will complete if the User does not select the Count Policy option.

Private Sub Count_Policy()
Dim rowRenewal As RenewalsRow

For Each rowRenewal In Me.PolicyDataSet.Renewals
   rowRenewal.PolicyCount = Me.PolicyDataSet.Renewals.Compute("Count(BrokerRef)", "PolicyRef = '" & rowRenewal.PolicyRef & "'")
Next

Me.PolicyDataSet.Renewals.AcceptChanges()

End Sub

Open in new window


I suspect that are just too many rows for the AcceptChanges to process.
Any suggestions on how I could improve this code to not cause a crash? Note that I cannot change the way that data is loaded into the dataset, so please do not give any suggestions that involve SQL.
LVL 1
jdhackettAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
Do you know how long the user waits? It could be that the computation is still going on and app is not responding to user input so user is killing it. You can update UI to indicate the progress.
0
 
Meir RivkinFull stack Software EngineerCommented:
what exception is being thrown?
0
 
jdhackettAuthor Commented:
No message appears on screen. The application just stops responding, and you have to end it from task manager.
I haven't been able to replicate the issue on my own PC, so I can't debug it from Visual Studio.
0
All Courses

From novice to tech pro — start learning today.