Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form-Fed Date for Select
Message
From
10/03/1999 02:54:27
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/03/1999 23:57:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00195444
Message ID:
00195737
Views:
19
>I'm trying to set up a form to input a date, and run a
>query using the date as a filter. I have a text field
>on the form, not tied to any table in the data environment,
>with a control source of ldpickup, and code for a button's
>click event as shown below. The thing keeps giving me
>operand/operator type mismatches.
>
>I'm pretty sure I'm handling something wrong on the WHERE
>clause but I can't find it. I've tried single quotes,
>parentheses, DTOC(), CTOD(), and looked in a few FAQ's
>and am out of guesses. Does anyone have the syntax for this?
>
>-----------------
>LOCAL ldpickup
>CLOSE DATABASES
>OPEN .\data\tracker
>SELECT Hospital.chospnam, Masspu.ddate, Masspu.nsmall, ;
> Masspu.nlarge ;
> FROM tracker!hospital INNER JOIN tracker!masspu ;
> ON Hospital.iacctno = Masspu.iacctno ;
> WHERE Masspu.ddate = ldpickup ;
> INTO TABLE .\data\tqbill01
>
>SELECT Hospital.chospnam, Indivpu.csize, Indivpu.curn, ;
> Indivpu,ncremid, Indivpu.cownlnam ;
> FROM tracker!hospital INNER JOIN tracker!indivpu ;
> ON Hospital.iacctno = Indivpu.iacctno ;
> WHERE Indivpu.dpickup = ldpickup ;
> INTO TABLE .\data\tqbill02
>
>REPORT FORM .\reports\rpbill NOCONSOLE PREVIEW
>-----------------
>
>Thank you ...
>
>- Bob Longmire
>- Hillside IL
Bob,
Remove the controlsource (none). Set the value to {}. Change SQL to read as :
...where Indivpu.dpickup = thisform.mycontrol.value ...
You would need intermediate variable(s) like ldPickup if you intend to use it in report too. ie:
-Two textboxes on form dStart, dEnd with value {}.
gdStart = min(thisform.dStart.value, thisform.dEnd.value)
gdEnd = max(thisform.dStart.value, thisform.dEnd.value)
select ... where myDate between gdStart and gdEnd .. into cursor ..
* In report - title band
"Sales for period "+dtoc(gdStart)+" - "+dtoc(gdEnd)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform