Change controls programatically on a form

Posted on 2006-03-26
Last Modified: 2006-11-18
Hi Experts,

I have 38 fields on a form named T1 to T38, and I need to be able to make them visible/invisible based on values in a table.

I have everything else working - but the bit I need help with is as follows:

Dim Counter As Integer
Counter = 1
t & Counter.Visible = True

Brings back "Cannot find control t & counter" rather than t1 - and I've exhausted my ideas.

Question by:Norbert2000
    LVL 34

    Accepted Solution

    Me.Controls("t" & Counter).Visible = True

    LVL 34

    Expert Comment

    Glad to help, good luck with the rest of your project(s)

    Dave :^)
    LVL 1

    Author Comment


    I've never met you but with my current deadline I love you.

    LVL 34

    Expert Comment

    LOL!  I know the felling :P


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now