Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 To: Rizwanuddin Khawaja
  
 
 
 Rizwanuddin Khawaja
 Tags
Subject: RE: VFP7 - SEEK and data verification in forms
Thread ID: 33776 Message ID: 33877 # Views: 2 # Ratings: 0
Version: Visual FoxPro 7 Category: Forms
Date: Thursday, December 04, 2003 5:16:14 PM         
   


> Hello all foxperts,
>
> I got great indirect help from Pete Sass, Eric den Doop, Fox Hound, Paul Culbertson and a lot of other forms expert; but still I am not able to solve my problem perfectly although foxite got 401 articles/postings related to SEEK.
>
> I am good in FPD26 and after a gap of two years I have to do a migration of huge system to VFP7 and
> I am new to VFP7 and I badly need the help of all the foxite experts at large.
>
> I want to verify the user inputs in TEXT box (or any other way) in FORM or FORMSET through memory variables;
>
> How can I do the exact following in VFP7?
> Which part of this code will go where in the properties?
> If FORMS are for backward compatibility, Then what is the VFP7 way to do it?
> Is there any better way to do the following?
> Is there any site/article/tips/refrences with STEP-BY-STEP help for developing an application
> and for MIGRATION?
> TASTRADE seems to me very advanced and sometime difficult to learn from it.
> VFP7 Documents seems to explainatory but with nearly no samples of properties examples ...
>
> Thanks in advance for your help. Have a nice day.
>
> Best regrds,
> Rizwan
>
>
>
 
> 
> **** Problem 1
> 
> mcustcode=0
> mname=SPACE(10)
> mnew_record=.F.
> 
> USE customers INDEX custcode ALIAS Clients
> ...
> @ xx,yy SAY & GET mcustcode
> READ
> 
> IF mcustcode=0   && A way to go out of main DO WHILE .T. loop; or to EXIT
>    error message
>    CLOSE DATA
>    RETURN
> ENDIF
> 
> SEEK mcustcode
> 
> IF EOF()  && Non-existing customer
>  mnew_record=.T.
> ENIF
> 
> * Diplay all fields on screen for ADDING / UPDATING & VERIFYING; field by field
> * Get the VERIFIED data
> 
> * Update table here
> 
> IF  mnew_record=.T.
>      APPEND BLANK
>      REPL new data
> ELSE
>      REPL updated data
> ENDIF
> ...
> 
> 

>
>
>
 
> 
> **** Problem 2
> 
> DO WHILE .T.
>  @ xx,yy SAY & GET mname
>  READ
> 
> IF mname=SPACE(10)
>     error message
>     LOOP
>    ELSE
>      EXIT
> ENDIF
> ENDDO
> 
> 

>



Hi,
Refresh my memory on the SEEK part of your concerns if this still exists?
If you are just wanting to verify data was keyed into a textbox, then Jamies
solution will work. This provides field level type validation as the user enters
the data. You can as well go with the valid event, but you are locked here
without entering some data to exit the textbox. There are work arounds to this,
and I can help you with this if you choose the valid event to validate. Can be
tricky.

The other method is Save level validation where all the validation
is coded in the Save command buttons click event. A validation problem found
usually entails a messagebox to advise the user of the problem, and a setfocus
back to the field not passing the validation rules.
Example of validation code in the save command button:

* --- Validation routine for required fields
IF EMPTY(Thisform.txtCC.Value)
messval=MESSAGEBOX('You are missing required ;
information. Ensure the Cost Center is entered prior ;
to Saving!',0+32,'Missing Cost Center!')
THISFORM.txtCC.SETFOCUS
RETURN
ENDIF

IF EMPTY(Thisform.txtType.Value)
messval=MESSAGEBOX('You are missing required ;
information. Ensure the Type is entered prior ;
to Saving!',0+32,'Missing Type!')
THISFORM.txtType.SETFOCUS
RETURN
ENDIF

Hope this helps.


Pete from the Great White North. (Only in Canada, ay.) Over and Out ...


ENTIRE THREAD

VFP7 - SEEK and data verification in forms Posted by Rizwanuddin Khawaja @ 12/3/2003 1:46:15 PM
RE: VFP7 - SEEK and data verification in forms Posted by James Stewart @ 12/4/2003 2:46:35 AM
RE: VFP7 - SEEK and data verification in forms Posted by Pete Sass @ 12/4/2003 5:16:14 PM