Results 1 to 4 of 4
  1. #1
    tariq1 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    16

    code to apply control formatting

    Hi,
    Thank you in advance for your assistance.
    Within a form I have a command button with the following code which


    should apply consistent formatting to each control within the form.
    It however dos not quite work, what am I missing here?


    Code:
    Private Sub Command29_Click()
    Dim i As Integer
    Dim c As Control
    For i = 0 To Me.Controls.Count - 1
    Set c = Me.Controls(i)
    c.GridlineStyleRight = Solid
    Next
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Wht does "not quite work" mean exactly?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tariq1 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    16
    Hi,

    Thank you for your prompt response. The code should apply the GridStyle = Solid to all the controls within the form.
    The formatting has not been applied to any of the controls.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I'm not clear on what that format is. This works:

    Code:
      Dim c                  As Control
      For Each c In Me.Controls
    
        'c.GridlineStyleRight = 1
        c.BackColor = vbYellow
      Next c
    In real code I'd limit it to the appropriate controls.
    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. Replies: 5
    Last Post: 03-14-2012, 08:32 PM
  2. How to filter dates using an apply filter code.
    By Jgreenfield in forum Reports
    Replies: 4
    Last Post: 11-15-2011, 01:38 PM
  3. Formatting Unbound Control
    By SltPhx in forum Forms
    Replies: 12
    Last Post: 08-17-2011, 01:49 PM
  4. Replies: 0
    Last Post: 03-14-2011, 08:38 AM
  5. Formatting control boxes in a Form
    By jbedward in forum Forms
    Replies: 1
    Last Post: 12-11-2009, 11:04 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