Access Forms: Set different field background color based on text box value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vic

    Access Forms: Set different field background color based on text box value

    Hi all,
    I am trying to set different background color based on text box
    value on a form. Basically, I have one form that display many lines of
    records(record source is a query), in each of the lines, if a text box
    named "status" is "C", THe line will be shown in green, else in red.
    Can this be done? ANyone can help me with this?


    Rgds,
    Vic
  • Allen Browne

    #2
    Re: Access Forms: Set different field background color based on text box value

    See:


    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Vic" <li.shen@uq.edu .au> wrote in message
    news:f499098d.0 409292252.50389 2a0@posting.goo gle.com...[color=blue]
    > Hi all,
    > I am trying to set different background color based on text box
    > value on a form. Basically, I have one form that display many lines of
    > records(record source is a query), in each of the lines, if a text box
    > named "status" is "C", THe line will be shown in green, else in red.
    > Can this be done? ANyone can help me with this?
    >
    >
    > Rgds,
    > Vic[/color]


    Comment

    • Vic Li

      #3
      Re: Access Forms: Set different field background color based on text box value


      Hi Allen,
      Thanks for the help. Great!!
      I have another problem here. On forms, I want to sort in ascending
      order if txtStatus = "YES" and decending order
      if txtStatus = "No". The form recordsource is already sorted by
      txtStatus.

      Thanks for help.

      Rgds,
      Vic

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Allen Browne

        #4
        Re: Access Forms: Set different field background color based on text box value

        Private Sub txtStatus_After Update()
        If txtStatus = "Yes" Then
        Me.OrderBy = "[NameOfFieldToSo rtByHere]"
        Me.OrderByOn = True
        ElseIf txtStatus = "No" Then
        Me.OrderBy = "[NameOfFieldToSo rtByHere] DESC"
        Me.OrderByOn = True
        Else
        Msg "Huh?"
        Me.txtStatus = Null
        End If
        End Sub

        --
        Allen Browne - Microsoft MVP. Perth, Western Australia.
        Tips for Access users - http://allenbrowne.com/tips.html
        Reply to group, rather than allenbrowne at mvps dot org.

        "Vic Li" <li.shen@uq.edu .au> wrote in message
        news:415cf707$0 $26105$c397aba@ news.newsgroups .ws...[color=blue]
        >
        > Hi Allen,
        > Thanks for the help. Great!!
        > I have another problem here. On forms, I want to sort in ascending
        > order if txtStatus = "YES" and decending order
        > if txtStatus = "No". The form recordsource is already sorted by
        > txtStatus.[/color]


        Comment

        Working...