Updating controls on Form2 from code on Form1

  • Thread starter Thread starter Darhl Thomason
  • Start date Start date
D

Darhl Thomason

I have a batch process that I run on my data to send emails based on a group
of recipients. I also have a progress meter (which is really just another
form) that updates based on the progress of the batch in the first form.
The progress bar works correctly.

At the end of the batch, I want to make a txtBox visible and assign a value
to it with a summary of the batch process. When I run the code I get the
following error: Run-time error '2465': Application-defined or
object-defined error".

I have tried various combonations of bang and dot in the code but just can't
seem to get it right.

Any help is appreciated.

Here is the code I am using within my first form to control the second form:

Forms!frmProgressBar.txtProgress.Visible = True
Forms!frmProgressBar.txtProgress = intProcessed & " emailed, " &
intNotProcessed & " not emailed, " & intTotal & " total records processed."

Thanks!

Darhl
 
The error you are getting suggest an incorrect reference to the object. Your
post doesn't say for sure, but if the progressbar form is a subform to the
form you are in, then you have to add that to the reference.
This examples should work if it is not a subform:
Forms!frmProgressBar!txtProgress.Visible = True
Forms!frmProgressBar!txtProgress = intProcessed & " emailed, " &
intNotProcessed & " not emailed, " & intTotal & " total records processed."

If it is a sub form:
Forms!MainForm!frmProgressBar!txtProgress.Visible = True
Forms!MainForm!frmProgressBar!txtProgress = intProcessed & " emailed, " &
intNotProcessed & " not emailed, " & intTotal & " total records processed."
 
Thanks Klatuu,

It is not a subform. I will try the bangs and dots where you suggest.

Darhl
 
Back
Top