Method 'Value' of '_CustomControl' failed (-2147417848)

  • Thread starter Thread starter falbrech_www
  • Start date Start date
F

falbrech_www

Hello all!

In my access application I implemented a progress bar. Within a loop I
am calculating the actual percentage of progress. The formula is as
follows:

Forms!frm_progress.progressbar.Value = vOffset + (vProcessedRecords
*100 / vNumberOfRecords)

This works for most of my cases (vNumberOfRecords < 100), but if the
number of records increases to 14000 I got the error "Method 'Value' of
'_CustomControl' failed (-2147417848)". This error seems to appear
randomly!

One situation where it appeared was the following values:

Forms!frm_progress.progressbar.Value = 0 + (347 * 100 / 14257)

whereas Forms!frm_progress.progressbar.Max = 100


Any ideas what goes wrong here?

Thanks in advance.
Florian
 
Your calculation is resulting in a number too complicated for the
ProgressBar control. In fact, I get a Runtime Error 6 (overflow) when I type
this into a Debug window:

?0 + (347 * 100 / 14257)

Try this instead:

Forms!frm_progress.progressbar.Value = CSng(vOffset + (vProcessedRecords /
vNumberOfRecords) * 100)
 
Hi Ron,
Forms!frm_progress.progressbar.Value = CSng(vOffset + (vProcessedRecords /
vNumberOfRecords) * 100)

OK, that's it! Thanks for your help! Anyway, I am still wondering why
this happens not everytime but only from time to time... Maybe this one
of those secrets we never get to know.

bye,
Florian
 
Back
Top