Question : Updating things based on info in a given record

Is there a way to have things change on a form based on the data in a given record?

I have a form that runs a query on my database and pulls up only the things with the "Status" field equal to "AOSVM" or "LFM."  What I want to do is check the "Status" and "MSGDate" fields, and if the "Status" is equal to "AOSVM" and the "MSGDate" is less than current date, change the background color of that (record)form to Red.  

I also would like it to do this based on browsing to the records via navigation buttons or searches and be able to change it back to the normal Blue color if the Date is equal to today. Im guessing it could not be a Form_Load type function or it would globally change the color on that form based on which record came up first.

Does anyone know how I could do this?

Answer : Updating things based on info in a given record

In OnCurrent event of your form you need to a these lines:

Dim ColorCode as long

If Status = AOSVM And MSGDate = Date() then
 
  ColorCode = 250 ' red

elseif MSGDate = Date() then

  ColorCode = =8421440  'blue

else

  ColorCode =-2147483633 'default (verify)

end if

Me.Section(0).BackColor=ColorCode
Random Solutions  
 
programming4us programming4us