Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
If ...............Else not working
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00761034
Message ID:
00761042
Vues:
22
I've never heard of an IF/ELSE/ENDIF statement not processing the ELSE portion. There must be something else going on in your program. In any event .. your separate IF statements will not work if the two values are equal because nothing will get set. You can do what you want without an IF statement as follows:

ThisForm.txtnHours.Value = MIN(wHour, nHour)

Cathy

>Hi All
>I used the following code to calculate certain hours worked but the ELSE statement gets ignored. All the values are correct.
>There is some calculations before this.
>
>" wHour = (45 - hHour)
> nHour = (thetot.sum_hours - (thetot.sum_shifts - dshift.sum_shifts))
> if nHour > wHour
> thisform.txtNhours.value = wHour
> else thisform.txtNhours.value = nHour"
>Only when nHour was > than wHour did it work right that left me to conclude
>that the else statment gets ignored.
>
>I then changed it to this which solved my problem.
> nHour = (thetot.sum_hours - (thetot.sum_shifts - dshift.sum_shifts))
> if nHour > wHour
> thisform.txtNhours.value = wHour
> endif
> if nHour < wHour
> thisform.txtNhours.value = nHour
> endif
>
>I would just like to know if anybody can shed some ligth on this
>
>Thanx
>Koot Coetzer
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform