Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jamie Osborn
  Where is Jamie Osborn?
 Melbourne
 Australia
 Jamie Osborn
 To: Chris Counts
  Where is Chris Counts?
 Bluefield
 West Virginia - United States
 Chris Counts
 Tags
Subject: RE: Validation Problems.
Thread ID: 16222 Message ID: 16226 # Views: 1 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Sunday, October 13, 2002 3:53:05 AM         
   


> I am having a problem with validating a text box on a form that I am creating. Whenver the textbox is validated a program runs that checks to see if that value exists in the table that the information is being input into. The problem that I have is that my client has their forms set up in wizard type fashion. Each control uses its own field in the table in the control source. So the program always finds the value of the field in the table even though the user hasn't saved it yet. If I can't figure out a way for this validation to work then I will have to completely redesign all of their forms. I would really appreciate any information that anyone can share on this subject.
>
> Thanks,+
> Chris Counts

Are you using buffering ? If so the solution is easy - don't used SEEK or LOCATE but use a SELECT statement as it will not see the un-committed data (ie. the new record).
If you aren't using buffering then you can take note of the key value for your current record and LOCATE for TestField = ValueITyped AND KeyValue <> KeyValueOfCurrentRecord.

ie. You are adding a new customer with these values:
CustId 123 (Candidate key produced internally)
CustCode "MCDONALDS"
............
You can validate by doing : LOCATE FOR CustCode = MyTextBoxValue AND CustId <> 123

If the field you are testing is the actual primary key then this is bad practice - you should be using a generated candidate key.

Cheers,
Jamie
jamie.osborn@foxite.com

ENTIRE THREAD

Validation Problems. Posted by Chris Counts @ 10/13/2002 2:07:13 AM
RE: Validation Problems. Posted by Jamie Osborn @ 10/13/2002 3:53:05 AM
RE: Validation Problems. Posted by Chris Counts @ 10/13/2002 8:25:30 AM