Results 1 to 6 of 6
  1. #1
    ped's Avatar
    ped is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    51

    Loop through all controls in form frame340

    Hi is there a way to loop through all controls in form frame340 and check for texbox type and then their values?

    Thanks in advance.

    I could not get suitable code....i did tried searching

  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,530
    This template code should get you started:

    Code:
      Dim ctl As Control
    
      For Each ctl In Me.Controls   
        Select Case ctl.ControlType
          Case acTextBox
           'do whatever
        End Select
      Next ctl
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ped's Avatar
    ped is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    51
    Paul, thanks for getting me started...

    tried this way and nothing happened..
    Code:
    Dim ctl As Control
      For Each ctl In Me.Frame7.Controls
        Select Case ctl.ControlType
          Case acTextBox
           MsgBox ctl.Value
        End Select
      Next ctl

  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,530
    I think you can only refer to the form, not the frame. To only look within a frame you'd probably need to use the Tag property and test that:

    If ctl.Tag = "Whatever" Then

    That said, controls within a frame don't typically have a Value property (though I've never seen a textbox within a frame). The frame contains the value of the group.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ped's Avatar
    ped is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    51
    Paul, that will solve my problem...thanks a lot!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No problem ped!
    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. form Controls
    By dref in forum Forms
    Replies: 2
    Last Post: 07-22-2011, 03:31 PM
  2. Controls within form
    By crowegreg in forum Forms
    Replies: 4
    Last Post: 05-31-2011, 08:39 AM
  3. form controls & recordset
    By slow&steady in forum Forms
    Replies: 2
    Last Post: 06-25-2010, 02:49 PM
  4. Accessing form controls
    By dante in forum Forms
    Replies: 15
    Last Post: 07-28-2009, 08:26 AM
  5. Adding Controls to a Form
    By msmayhew in forum Programming
    Replies: 7
    Last Post: 12-14-2005, 03:26 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