[AccessD] Setting Box Forecolor

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Mon May 1 09:43:38 CDT 2006


Dear List:

I have several manikin diagrams with boxes where a patient experience 
pain.  When they click the box it turns from green to red (and v.v.).  
When the forecolor of the box changes I save it in a Yes/No field in the 
patient record in the patient table - Yes for red, No for green.

On entering the form for the second or subsequent times, in the 
Form_Open event I want to change the boxes to red which were previously 
turned red but I'm having a problem with the syntax.  The boxes are 
uniformly named "Boxnnnnnn" (length can vary) and the corresponding 
fields are named "fldPLnnnnnnn"

So I'm using:

Set db = CurrentDb
Set rs = db.OpenRecordset("Select * FROM tblPatient WHERE 
fldPatientRecordID = " _
    & Forms!frmPatient!fldPatientRecordID)
For Each fld In rs.Fields
    If Left(fld.Name, 5) = "fldPL" Then
        If rs(fld.Name) = True Then
            strControl = ("Box" & Right(fld.Name, Len(fld.Name) - 5))
            Set ctl = Me(strControl)
            ctl.ForeColor = 255
        End If
    End If
Next fld

to find the fields beginning with fldPL and everything works, I get the 
box name in strControl,  OK except where I want to set the forecolor of 
the box to red it doesn't work (property or method not supported). Does 
someone know the correct method/syntax?

MTIA,

Rocky

P.S. - additional question for the future - this app is coming from a 
back pain specialist who saw The Sleep Advisor and wants to do a similar 
expert system to diagnose back pain.  Very interesting idea.  In the 
meantime, the areas of pain on the manikins are, of necessity, 
rectangles.  But on his original drawings, they are irregular shapes 
conforming to the outlines of the body.  As it is now, it will do for 
alpha and beta testing, but ultimately we'll need something more 
precise.  Does anyone have any ideas on how to draw irregular shapes on 
a form which will respond to a mouse click?

MTIA again.

-- 
Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com




More information about the AccessD mailing list