Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Operator/operand type mismatch
Message
 
 
À
30/10/2017 13:12:37
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01655283
Message ID:
01655285
Vues:
50
>Hi everyone,
>
>I'm at lost why this particular value in a text box "2017" doesn't match the fieldname (paystart) while the rest does like "2016", "2015" and the likes except "2017 as mentioned. I dont know what i might be missing out.
>
>here is the sample code
>
>
>
>** in a form there is a text box where one has to key in the year (.txtYear.value="2016")
>** A.paystart is a datefield in ORlist table
>
>local ldYear
>
>With Thisform
>     ldYear =  .txtYear.Value
>endwith
>
>SELECT A.paystart, A.clientID, B.ClientName, A.Amount FROM ORlist as A Left Join Client as B ON A.ClientID=B.ClientID;
>WHERE YEAR(A.paystart)=VAL(ldYear) INTO CURSOR CollectAmt ORDER BY A.clientid
>
>
>
>
>
>The results displays everything for any other year except "2017" and I have no idea why is it like this for this particular year 2017 and would always result into an operator/operand type mismatch error message.
>
>Any idea or tips on what i might be missing in this code?
>
>Thanks in advance
>
>Sonny

If you're using VFP9, I suggest to do

lnYear = cast(thisform.txtYear.value as int)

and use lnYear directly.

Also, do you have index on year(PayStart)? Otherwise your statement is not Rushmore optimizable.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform