Results 1 to 5 of 5
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    "Hidden" controls

    An old trick of mine with reports, where field references are needed in the code sheet of the report but not displayed in the report, is to simply create a text-box whose ControlSource is the field of interest and make the control not visible. So, if such a control is created (or left over from an old version of the report) and the field is not included in the RecordSource for the form, one will be prompted for the value when the report opens. My problem is an old report that presumably has some "hidden" controls like I've described here, but I can't find them.

    I tried to run this code in the open event:



    dim i as integer
    for i = 0 to 20
    debug.print me.controls(i)
    next

    Access 2003 does not like the debug statement stating non-supported method. (what's wrong with my code?)

    If I can get a list of controls. Is there a way within the report's design mode to delete a control, even if I can't see it?

    Thanks,
    Bill

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    Try:
    Code:
    Dim ctl As Control
    For Each ctl In Me.Controls
        If ctl.ControlType = acTextBox Then
            Debug.Print ctl.Name
        End If
    Next ctl
    Set ctl = Nothing
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Code worked perfectly. And, I see the three text-boxes that need to be deleted but they are not visible in design view. Is there a way to delete them in code?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    I don't understand how textboxes cannot be visible in design view. Sounds like corruption. I suggest creating a new form and copy/paste the good controls to the new form. Then delete the old form and rename the new one.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    That was going to be my next move, no pun intended. And yes, I suspect you're right about the corruption.
    Thanks,
    BIll

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  2. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  3. Replies: 7
    Last Post: 02-23-2012, 07:19 PM
  4. "On Current" event and ActiveX controls
    By beru777 in forum Programming
    Replies: 7
    Last Post: 12-20-2011, 10:32 AM
  5. Bound controls "mis"behaving
    By DanW in forum Forms
    Replies: 3
    Last Post: 11-16-2009, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums