Results 1 to 4 of 4

Thread: SOLVED: Uncooperative label control properties

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Contributor
    Joined
    Jun 2004
    Location
    Texas
    Posts
    139
    Location

    Unhappy SOLVED: Uncooperative label control properties

    Hi,

    I am working on a piece of code which, based on the user's selection, loops through all the db forms and changes several properties of all label controls. Among other things, I want the code to change the labels' bg color based on user selection, but I never want the labels' bg style to be transparent.

    I started with all labels set to normal, and the default control style is normal. My code specifically sets it to normal as well. After the code runs, the default control style is set to normal, but EVERY LABEL has reverted to transparent. I cannot figure out why they are doing this!! I am confused and frustrated.

    Please help if you can. I have posted the most relevant chunk of my code below, dunno if it will help or not, please ask if more info would help you help me!! Suggestions are deeply appreciated. Thank you so much!!!

    [vba]
    For Each doc In ctr.Documents
    DoCmd.OpenForm doc.Name, acDesign, , , , acHidden
    Set frm = Forms(0)
    If frm.Tag = "BGNrml_TextNrml" Then
    With frm
    .Section(acDetail).BackColor = 16764057
    .Section(acPageHeader).BackColor = 16764057
    .Section(acPageFooter).BackColor = 16764057
    .Section(acHeader).BackColor = 16764057
    .Section(acFooter).BackColor = 16764057
    End With
    End If
    For Each ctl In frm.Controls
    If ctl.Tag = "BGNrml_TextNrml" Then
    ctl.BackStyle = Normal
    ctl.BackColor = 16764057
    ctl.ForeColor = 0
    ElseIf ctl.Tag = "BGNrml_TextHighlight" Then
    ctl.BackStyle = Normal
    ctl.BackColor = 16764057
    ctl.ForeColor = 16711680
    ElseIf ctl.Tag = "BGHighlight_TextDrk" Then
    ctl.BackStyle = Normal
    ctl.BackColor = 16776960
    ctl.ForeColor = 0
    ElseIf ctl.Tag = "LineNrml" Then
    ctl.BorderColor = 0
    ElseIf ctl.Tag = "LineHighlight" Then
    ctl.BorderColor = 16711680
    End If
    Next ctl
    DoCmd.close acForm, doc.Name, acSaveYes
    Next doc
    [/vba]
    Last edited by mark007; 06-30-2004 at 06:12 AM. Reason: Check out the VBA tags for formatting code!;)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •