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

    Sub-form reference incorrect?

    I have a subform where I'm wanting to toggle the visibility property depending on changes to the sub-forms recordsource.



    Here's the code: (snipit)
    If bolautobraodcast = True Then
    Me.RegistryNamesOnlyFiltered.Controls(lblBroadcast ).Visible = True
    Me.RegistryNamesOnlyFiltered.Controls(chkBroadcast ).Visible = True
    Else
    Me.RegistryNamesOnlyFiltered.Controls(lblBroadcast ).Visible = False
    Me.RegistryNamesOnlyFiltered.Controls(chkBroadcast ).Visible = False
    End If

    The code runs okay as I step through in Debug, but two fields remain visible when the code path sets them False.

    Is my sub-form reference incorrect?

    Thanks,
    Bill

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is RegistryNamesOnlyFiltered the name of the subform? Try

    Me.RegistryNamesOnlyFiltered.Form.Controls("lblBroadcast").Visible = True

    Note additions in red.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Hi Paul,
    That did the trick. And yes, RegistryNamesOnlyFiltered is the name of the sub-form.

    Some old code I'm adding to.......so old that Options Explicit not turned on, as is my practice now. Just happened to notice that and compiler complained about the un-quoted field names as soon as I turned option on. I think I might have thought about the controls collection needing the quotes had the compiler complained initially.

    Reno is supposed to get hammered on Sunday. We've had pretty close to 10 inches of rain since Monday here in Graeagle. Little Graeagle creek looks like the Truckee now. And the Feather looking pretty close to the Mississippi.

    Thanks,
    Bill

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem Bill. It has been raining most of the day. I was hoping it was snow in the higher elevations. I hope we don't have any flooding issues. All that rain up there is a concern, as you know. Luckily we live on a ridge, so if water gets up to our house, we'll catch a ride from Noah.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Docmd.form cause reference error
    By snoopy2003 in forum Programming
    Replies: 0
    Last Post: 03-10-2011, 10:49 AM
  2. Reference to a query from a form does not work
    By giladweil in forum Access
    Replies: 3
    Last Post: 02-28-2011, 06:38 AM
  3. Control Reference on a Form
    By gmitchell@exbrief.com in forum Forms
    Replies: 5
    Last Post: 01-24-2011, 12:31 PM
  4. Replies: 0
    Last Post: 08-01-2009, 12:43 PM
  5. Form Name Reference in VBA
    By Simon Sweet in forum Programming
    Replies: 0
    Last Post: 05-22-2008, 01:55 PM

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