Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable in Reference String? 1

Status
Not open for further replies.

TwoOdd

Programmer
Sep 10, 2003
196
CL
Not sure how to state this other than by showing an example. I want to create a function that will allow me to send a variable to it to reference a field dynamically.

Code:
    If Me.sfm_Factors![varColumn].ColumnHidden = True Then
        Me.sfm_Factors![varColumn].ColumnHidden = False
        Me.cmdBuilding.Caption = "Hide " & varDesc
    Else
        Me.sfm_Factors![varColumn].ColumnHidden = True
        Me.cmdBuilding.Caption = "Show " & varDesc
    End If

The [varColumn] is the field that I want to show/hide and I have many fields and only wanted to write the if...then statement once.

Any idea on how to do this?

Thanks,

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
Hi
Maybe:
[tt]varcolumn=TheColumnName
Me.sfm_Factors(varcolumn).ColumnHidden = ...[/tt]
 
Thanks, it worked like a charm!

TwoOdd
--------------
Good judgment comes from experience, and experience comes from bad judgment.
-- Barry LePatner
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top