Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Eric den Doop
  Where is Eric den Doop?
 Houten
 Netherlands
 Eric den Doop
 To: Richard Lewis
  Where is Richard Lewis?
 Cape Girardeau
 Missouri - United States
 Richard Lewis
 Tags
Subject: RE: Limit data in a field with value from a lookup table
Thread ID: 578 Message ID: 585 # Views: 1 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Wednesday, June 06, 2001 11:16:16 AM         
   


> Thanks for the reply, but I am interested in limitting the legal values at the database level. ie - I have a client demographic table with a race code field. I want the race field to except only values present in my code table. I am using a statement like seek(race,"race","ckey") in the field validation rule. In this case, the race table must be open to modify the client demo table. Is there a different approach I might use.
>
> ps. - I would like to keep the check on the back side, not in the user interface. Thanks
>
> Richard G. Lewis

I see. I think you have a stored procedure or a normal function that checks the input, am I correct? If not, then create one, for example:
FUNCTION CheckRaceCode(tcInputVal)
LOCAL llUsed, laDummy[1], llRetval, lcOldAlias
lcOldAlias = ALIAS()
llUsed = USED("racetable")
*write the parameter validation code yourself, f.e. empty(), type() etc.
SELECT race_code ;
FROM racetable ;
WHERE race_code == tcInputVal ;
INTO ARRAY laDummy
llRetval = _tally > 0
* llRetval = .T.: record found, .F. otherwise
IF NOT llUsed
USE IN racetable
ENDIF
IF NOT EMPTY(lcOldAlias) AND USED(lcOldAlias)
SELECT (lcOldAlias)
ENDIF
RETURN llRetval

In the validation field, call this function
CheckRaceCode(yourfield)

Just a thought (without testing...)
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts

ENTIRE THREAD

Limit data in a field with value from a lookup table Posted by Richard Lewis @ 6/6/2001 8:14:22 AM
RE: Limit data in a field with value from a lookup table Posted by Eric den Doop @ 6/6/2001 8:27:15 AM
RE: Limit data in a field with value from a lookup table Posted by Richard Lewis @ 6/6/2001 9:57:29 AM
RE: Limit data in a field with value from a lookup table Posted by Eric den Doop @ 6/6/2001 11:16:16 AM
RE: Limit data in a field with value from a lookup table Posted by Richard Lewis @ 6/6/2001 1:05:01 PM