You may get a different answer to this, but IMHO, there is no need to pass
these objects to your functions (and I assume when you say "fields" that
what you actually mean are textBox controls from your form) . The Forms
collection is accessible at any time through code, so therefore, all of your
controls are accesible. Therefore, this code will work in any module or
form to reference the controls of any open (hidden or visible) form:
Dim formName as String
formName = "MainForm"
Forms(formName).txtCompanyName.visible = False
Forms(formName).lstEmployess.visible = False
formName = "EmployeeForm"
Forms(formName).cboJobTitle.visible = True
or
Forms("PositionForm").txtDuties.visible = False
or even
DoCmd.OpenForm "DataTransferForm"
Dim frm As Form
Set frm = Forms("DataTransferForm")
frm.txtProgressLabel.Caption = "Transferring Data"
Darryl Kerkeslager
"SV" <SV@skynet.be> wrote in message
news:41**********************@news.skynet.be...
Dear all,
In my application I have a lot of hidden fields. I want to make them
invisible for the users though for debugging reasons I want to make them visible. So
I want to add these objects to an array-variable and pass this variable to a
subroutine in which I make all stored objects in the array-variable
invisible.
Can somebody explain me how to declare the correct variables, how to pass
these to a sub routine and how to make these objects invisible ?
This is what i have so far but without any success.
Private Sub Form_load()
dim HiddenFields() as object
HiddenFields(1) = me.TextBox1.name 'one object on the form
MakeUnvisible(HiddenFields) 'passing the array var to the subrouting
Endsub
public sub MakeUnvisible(ByRef Fields as object)
Fields(1).visible = false
end sub
Thanks for any suggestions,
S.V.