reusable code

JCross

Registered User.
Local time
Today, 06:55
Joined
Feb 28, 2002
Messages
116
hi! i have a chunk of code to set the visibility of command buttons on each of my forms. There are only 2 modes, and each line looks like

me.cmdClose.visible = true

all the cmdbuttons are named the same on each form, and i'd like to create a public sub to call instead of copy/pasting the chunk-o-code.

Public Sub Edit_Mode

(how do i refer to the me part of the
me.cmdClose.visible = false)

End Sub

Thank you!

Jennifer
 
Not sure of the syntax but you need to create somthing like

Dim frmActive as Form
Set frmActive = ActiveForm(you need to find the syntax)
frmActive.cmdButton1.Visible= False
etc.


HTH
 
Thanks, Harry - but the whole passing in the form name thing is what I have a hard time with.

OOH! I got it. yay!
Thanks anyway, y'all.

Jennifer

[This message has been edited by JCross (edited 03-27-2002).]
 
Public Sub Edit_Mode(ByRef frm as Form,Optional fVisible as Boolean=True)

frm.cmdClose.visible = fVisible

End Sub
 

Users who are viewing this thread

Back
Top Bottom