Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate Userid & Password
Message
From
17/05/2008 15:39:28
 
 
To
17/05/2008 12:15:13
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01317860
Message ID:
01317871
Views:
6
The way this code is written you will never get to the management form. The steps as written are
1. Check to see if the password is valid
2. release the form
3. do the management form.

But step 3 can never happen because you have released the current form in step 2.

I think the simplest way to restructure the code is>
if Users.Password == PADR(ALLTRIM(thisform.txtPassword.value),LEN("Users.Password"))
     * This is a valid user
     DO FORM C:\HPRC\MANAGEMENT.SCX
else
   * The password is not valid
endif

RELEASE thisform
You need to put some logic into the ELSE clause to let the user know what happened and do whatever is needed (usually either allow another try or close the form)

FWIW........One of the great things MS did with Fox was make it as backwards compatible as possible. You can code almost exactly as you did 10 years ago and it will probably work. Depending upon your (and your user's) requirements, this might be sufficient (heresy, I know). So you could code this as you would have all those years ago, get it working, and then try to bring the coding style into the modern era. You could even code this is some other language you currently use and then translate it. The language specifics may vary, but the logic should be very close.

>So I am again trying to figure out the validation of a simple password form I have created, below is some code I was trying to get to work and since I could not make that work I stopped mid stride.....
>
>
>
>if Users.Password == PADR(ALLTRIM(thisform.txtPassword.value),LEN("Users.Password"))
>        * This is a valid user
>   else
>      * The password is not valid
>  endif
>RELEASE thisform
>DO FORM C:\HPRC\MANAGEMENT.SCX
>
>
>
>The table users only has 3 fields userid,username,password,
>
>If anyone can point me in the right direction .....
>
>
>Thanks,
>
>Fred W.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform