Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Vic
Guest
 
Posts: n/a
#1: Nov 13 '05
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
Guest
 
Posts: n/a
#2: Nov 13 '05

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


See:
http://www.lebans.com/conditionalformatting.htm

--
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.0409292252.503892a0@posting.google.c om...[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]


Vic Li
Guest
 
Posts: n/a
#3: Nov 13 '05

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!
Allen Browne
Guest
 
Posts: n/a
#4: Nov 13 '05

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


Private Sub txtStatus_AfterUpdate()
If txtStatus = "Yes" Then
Me.OrderBy = "[NameOfFieldToSortByHere]"
Me.OrderByOn = True
ElseIf txtStatus = "No" Then
Me.OrderBy = "[NameOfFieldToSortByHere] 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]


Closed Thread