Referencing form labels from code? (1 Viewer)

ListO

Señor Member
Local time
Today, 12:02
Joined
Feb 2, 2000
Messages
162
I thought this would be easy, but my brain doesn't seem to grasp the concept...

I have a number of forms, each of which has an invisible label with the same name (DoneLabel).

From time to time I would like to make that label visible for a second or so, then make it invisible. The operative code looks like this:
Code:
  Private Sub FlashDone()
      Pause (conDonePause)
      DoneLabel.Visible = True
      Pause (conDonePause)
      DoneLabel.Visible = False
  End Sub

(I have a subroutine which inserts a pause of variable duration).

Rather than imbed the same code into each form, I'd like a little public sub that I can call from any form which needs it. I'm having difficulty in how to reference the calling form and label, or how to call the public sub and pass proper information to it.
 

Banana

split with a cherry atop.
Local time
Today, 04:02
Joined
Sep 1, 2005
Messages
6,318
To work for any form, I'd probably do this:

Code:
Private Sub FlashDone(frm As Form)
      Pause (conDonePause)
      frm.DoneLabel.Visible = True
      Pause (conDonePause)
      frm.DoneLabel.Visible = False
End Sub

Then you can call it from a button on a form like this:

Code:
FlashDone Me
 

ListO

Señor Member
Local time
Today, 12:02
Joined
Feb 2, 2000
Messages
162
Thanks, Bannana. That worked as desired.

I was trying something a lot more complicated on the theory that three right turns would make one left. But I missed a turn.
 

Users who are viewing this thread

Top Bottom