A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Largest Value



 
 
Thread Tools Display Modes
  #1  
Old April 8th, 2008, 08:08 PM posted to microsoft.public.access.forms
Donna
external usenet poster
 
Posts: 565
Default Largest Value

I have a form where I want the background color to change based on if it's
the most recent record; If a person has 3 contracts, 200601, 200701,
200801, I want 200801 to be one color and the others to be another color.
How would I code the on current event to show this.

Right now I am thinking something like:


Dim lngYellow As Long, lngBlue As Long
lngBlue = RGB(161, 205, 253)
lngYellow = RGB(219, 156, 254)

If Me.StartYr.Value = ?????? Then
Me.Detail.BackColor = lngYellow

Else
Me.Detail.BackColor = lngBlue
End If

Any suggestions? Thanks for your help.
  #2  
Old April 8th, 2008, 10:28 PM posted to microsoft.public.access.forms
strive4peace
external usenet poster
 
Posts: 1,670
Default Largest Value

Hi Donna,

If Me.StartYr = nz(dMax("[StartYr]", "[Tablename]", "condition"))

WHERE
Tablename is the name of your table
condition is something like
"PersonID=" & nz(me.PersonID,0)

Warm Regards,
Crystal

*
(: have an awesome day
*


Donna wrote:
I have a form where I want the background color to change based on if it's
the most recent record; If a person has 3 contracts, 200601, 200701,
200801, I want 200801 to be one color and the others to be another color.
How would I code the on current event to show this.

Right now I am thinking something like:


Dim lngYellow As Long, lngBlue As Long
lngBlue = RGB(161, 205, 253)
lngYellow = RGB(219, 156, 254)

If Me.StartYr.Value = ?????? Then
Me.Detail.BackColor = lngYellow

Else
Me.Detail.BackColor = lngBlue
End If

Any suggestions? Thanks for your help.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:46 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.