Hello All,

I have a program that obtains numerical data from editable text fields and
then does some calculations on them. If the fields are empty and I press
"OK" to get the data from the form and then process it, I get the following
error: "RxKinetics 1.0 has just read directly from memory manager data
structures". When the fields contain data, everything is fine. I know it is
something simple but I am so tired of looking at the code. I thought another
set of eyes would help.

Thanks!

Andy

static void GetFieldText(UInt16 objResID, Char* text)
{
    FieldPtr fldP;
      MemHandle   textH;
      Char*  textP;

      fldP  = (FieldPtr)GetObjectPtr(objResID);
      textH = FldGetTextHandle(fldP);
      if (textH) 
      {
         textP = (Char*) MemHandleLock(textH);
         StrCopy(text,textP);
          MemHandleUnlock(textH);
      }
      else
      {
           text = NULL;
      }
}


//Function to get the patient data from the form
static void GetPatientData(double *loadingDose, Int16 *male, double *age,
double *ABW, Int16 *pounds, double *feet, double *inches, double *scr)
{
    Char *text = MemPtrNew (16);

    
    GetFieldText (InitialDoseAgetextField,text);    //code to get age field
    if (text)
    {
        *age = strToDouble (text);
        if ( *age < 18 && *age > 0)
        {
            *age = 1;
        }
        MemPtrUnlock (text);
        text = MemPtrNew (16);

    }
    else
    {
        *age = 0;
    }
    
    GetFieldText (InitialDosePoundsField, text);        // weight field
    if (text)
    {
        *ABW = strToDouble (text);
        MemPtrUnlock (text);
        text = MemPtrNew (16);
    }
    else
    {
        *ABW = 0;
    }
    
    GetFieldText (InitialDoseScrField, text);        //code to get serum
creatinine
    if (text)
    {
        *scr = strToDouble (text);
        MemPtrUnlock (text);
    }
    else
    {
        *scr = 0;
    }
//other non-relevent code goes here
}




-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to