Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with Building Where Clause for date range
Message
From
10/08/2004 00:08:13
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Help with Building Where Clause for date range
Miscellaneous
Thread ID:
00931941
Message ID:
00931941
Views:
73
I have a form that has optional date range textboxes on it - start date and end date. The data in those fields is text since I could not figure out how to make it a date datatype. I am building a SELECT statement, but since this field is optional, I figure I must build a string for my where clause and then put it in the select. I cannot figure out how to get the where clause to work. Any help is greatly appreciated.

whereclause = ''
startdate = ALLTRIM(THISFORM.txtStartDate.Value)
enddate = ALLTRIM(THISFORM.txtEndDate.Value)

IF !EMPTY(startdate)
whereclause = 'and invpost.invdate >= "&startdate"'
ENDIF

SELECT invpost.invno,invpost.custno,invpost.invdate,invitempost.itemno ;
FROM invpost INNER JOIN invitempost ;
ON invpost.invno = invitempost.invno ;
INTO CURSOR curResults ;
where invpost.custno = '&selectedcustomer' ;
&whereclause ;
ORDER BY invpost.invdate


Randy Wessels
Next
Reply
Map
View

Click here to load this message in the networking platform