Results 1 to 8 of 8
  1. #1
    maysamab is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2008
    Location
    -
    Posts
    6

    Post Background Format

    Dear All,


    I Use Ms-Access 2003 Proffesional For My Porpuse.
    I Want Select Colour Conditional Formating For textbox For Generating Report.
    I Want Put Other Colours that they don't exist in Color Window(In Conditional Formatting Window)
    For Example:
    I Want Select Light Grey Colour For My Text Box But In Colour Pallet in Conditional Formating Window there is One Grey Colour.


    How I Can Select Other Colour in Conditional Formatting Window For Text Boxes?

  2. #2
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    Use vba code to control the color instead.
    Example code is as follows:
    Code:
    Private Sub Details_Format(Cancel As Integer, FormatCount As Integer)
    
        lngred = RGB(255, 0, 0)
        lngBlack = RGB(0, 0, 0)
        lngyellow = RGB(255, 255, 0)
        lngWhite = RGB(255, 255, 255)
    
        If Me.tbox1 = 1 Then
            Me.tbox1.BackColor = lngred
            Me.tbox1.ForeColor = lngyellow
        End If
    
    End Sub

  3. #3
    maysamab is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2008
    Location
    -
    Posts
    6

    Thanks But ....

    Dear My Friend,
    Thanks for Your Attention But How can i Use This code For My Report.
    What is the "Me" in your Code?
    Thanks

  4. #4
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    In VBA Module,
    me = report in report
    me = form in form

  5. #5
    maysamab is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2008
    Location
    -
    Posts
    6
    Thanks
    And How can I Link this code to My report or My form?

  6. #6
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    You'd better see some elementary access vba book first to grasp the basic knowledge so that you could use it in your report and form accordingly

  7. #7
    maysamab is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2008
    Location
    -
    Posts
    6
    Dear My Friend
    Private Sub Report_Activate()
    lngred = RGB(255, 0, 0)
    lngblack = RGB(0, 0, 0)
    lngyellow = RGB(255, 255, 0)
    lngwhite = RGB(255, 255, 255)

    aa = TBOX1
    If Me.TBOX1 = "AMIR" Then
    Me.TBOX1.BackColor = lngred
    Me.TBOX1.ForeColor = lngyellow
    Else
    Me.TBOX1.BackColor = lngblack
    Me.TBOX1.ForeColor = lngwhite


    End If
    End Sub

    I could write this code and link for my report successfully.
    but i have many name like "AMIR" "MARY" "JOHN"
    my code just compare first record with "AMIR" and if First Field is "AMIR" then All records in tbox1 in report is yellow but i want just amir is yellow!!
    I read some vba access book but i can't solve this problem.

  8. #8
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    You should not use the Report_Activate() event in your case.

    Instead you should simply use my previous stated event details_format() event.

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

Similar Threads

  1. Text Box Format
    By Scott in forum Forms
    Replies: 0
    Last Post: 01-09-2008, 11:13 PM
  2. Date Format
    By wasim_sono in forum Forms
    Replies: 2
    Last Post: 08-15-2006, 01:20 AM
  3. Conditional Format Query
    By Schwagr in forum Queries
    Replies: 3
    Last Post: 03-20-2006, 02:39 PM
  4. Date Format
    By St3ph3n in forum Access
    Replies: 4
    Last Post: 03-09-2006, 11:23 AM
  5. Change the colour of a form background
    By r_e_v_a_n_s in forum Forms
    Replies: 0
    Last Post: 11-15-2005, 03:39 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