Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2003
    Location
    Slovenia, EU
    Posts
    16

    Unanswered: Continuous form & colour change

    I have been trying to find out how to do following:

    I have one continuous form with records and now would like to change background colour of one section: Detail based on check box (yes/no).

    the code for changing would go like this:

    Private Sub Check_Click()
    If Me.Check = True Then
    DoCmd.RunMacro "mcrCheckBoxGreen"
    Else:
    DoCmd.RunMacro "mcrCheckBoxGrey"
    End If
    End Sub

    And the code for one colour change would be like this:

    '------------------------------------------------------------
    ' mcrCheckBoxGrey
    '
    '------------------------------------------------------------
    Function mcrCheckBoxGrey()

    Forms!frmCheck.Section ( 0 ) [].BackColor = - 2147483633

    End Function

    But here is a problem. The thing perfectly works and changes colour of all forms! That is not good enough. I would like to make it only for the form with "Me.Check = True".

    How can I do that? Is it possible? Mabe if I use ID of a record or something?
    MS Access 2000 - 2003, WinNT - WinXP

  2. #2
    Join Date
    Oct 2003
    Location
    US
    Posts
    343

    Re: Continuous form & colour change

    Not easy, the background color in continuous forms is white but there s code available to cahnge it. Its painful but possible. I don't have the code but have seen it here in the forum. search for it.


    Originally posted by primus
    I have been trying to find out how to do following:

    I have one continuous form with records and now would like to change background colour of one section: Detail based on check box (yes/no).

    the code for changing would go like this:

    Private Sub Check_Click()
    If Me.Check = True Then
    DoCmd.RunMacro "mcrCheckBoxGreen"
    Else:
    DoCmd.RunMacro "mcrCheckBoxGrey"
    End If
    End Sub

    And the code for one colour change would be like this:

    '------------------------------------------------------------
    ' mcrCheckBoxGrey
    '
    '------------------------------------------------------------
    Function mcrCheckBoxGrey()

    Forms!frmCheck.Section ( 0 ) [].BackColor = - 2147483633

    End Function

    But here is a problem. The thing perfectly works and changes colour of all forms! That is not good enough. I would like to make it only for the form with "Me.Check = True".

    How can I do that? Is it possible? Mabe if I use ID of a record or something?

  3. #3
    Join Date
    Nov 2003
    Location
    Slovenia, EU
    Posts
    16
    Thanks,

    well if it is possible I will somehow do it
    MS Access 2000 - 2003, WinNT - WinXP

  4. #4
    Join Date
    Sep 2003
    Location
    Birmingham, UK
    Posts
    121
    Right click on the control on the form and select Contional Formatting from the menu. You can then set conditions based upon certain criterias. not sure if it works with Checkboxes though. You'll have to mess

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    What SexualChocolate said is true ... It should work for checkboxes also.

  6. #6
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238

    Re: Continuous form & colour change

    Originally posted by primus
    I have been trying to find out how to do following:

    I have one continuous form with records and now would like to change background colour of one section: Detail based on check box (yes/no).

    the code for changing would go like this:

    Private Sub Check_Click()
    If Me.Check = True Then
    DoCmd.RunMacro "mcrCheckBoxGreen"
    Else:
    DoCmd.RunMacro "mcrCheckBoxGrey"
    End If
    End Sub

    And the code for one colour change would be like this:

    '------------------------------------------------------------
    ' mcrCheckBoxGrey
    '
    '------------------------------------------------------------
    Function mcrCheckBoxGrey()

    Forms!frmCheck.Section ( 0 ) [].BackColor = - 2147483633

    End Function

    But here is a problem. The thing perfectly works and changes colour of all forms! That is not good enough. I would like to make it only for the form with "Me.Check = True".

    How can I do that? Is it possible? Mabe if I use ID of a record or something?
    Follow this link and try the attached database.
    http://www.mvps.org/access/forms/frm0024.htm
    It is good if you want alternating colours for each row rather then conditional formatting

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Instead of changing the background color, you could also create rectangular boxes that cover the background. Then you could either set the color of the box or have a box for each color and set its visible property based on your criteria.

    blindman

  8. #8
    Join Date
    Nov 2003
    Location
    Slovenia, EU
    Posts
    16

    Colours

    Thanks justin_tighe,

    I found the file, now we will see about it!

    PS - I have tried conditional formatting - not good enough

    But I like the idea about rectangular boxes - that could be usefull!

    Thanks all
    MS Access 2000 - 2003, WinNT - WinXP

  9. #9
    Join Date
    Dec 2002
    Location
    Glasgow, UK
    Posts
    100
    why don't you like conditional formatting? - I find that it works very well.
    Access XP & WinXP Pro

  10. #10
    Join Date
    Nov 2003
    Location
    Slovenia, EU
    Posts
    16

    conditional formatting

    Well,

    I would like to have a little graphic on a form, for example lights depended on current record status (red, green, etc...) and that's why I don't need conditional formatting. But of course it is a nice way for colour changing depending on record value.
    MS Access 2000 - 2003, WinNT - WinXP

Posting Permissions

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