Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems summing values in one field between 2 dates
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00341684
Message ID:
00341799
Views:
25
Kelly,

>I'm new at visual fox pro trying to sum records from a field that is called paidamout between certain matching dates which a user will input in 2 text boxes that will match up with a field called paiddate. Then hit a button that runs my select sum statement. The problem is if I put in a fixed date in the where statement like WHERE Inv.solddate = {5/30/95} it works but, when I try to get it from the text box value it gives me this error that says operator/operand type mismatch. Here is my select statement, which I have in the procedure of the command button.
>
>local setdate1 setdate2
>setdate1 = thisform.text1.value
>setdate2 = thisform.text3.value

>SELECT SUM(Inv.soldprice);
> FROM pawn!Inv;
> WHERE Inv.solddate BETWEEN setdate1 AND setdate2
>
>Thanks Kelly

First of all, that is the type of text1.value and text3.value? If you didn't set
the default value to be {}, these values would be character format, not date, and you have to use ctod() function. This function may say 'Ambiguois date format ... ', etc.

The second problem: I would prefer to use BETWEEN function, e.g.
BETWEEN( soldate, setdate1, satdate2).

Third: If you use only one table in your select, you don't need to use table name as a prefix.

HTH
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform