Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Basic User Input to search and report
Message
De
24/04/2000 09:14:39
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00355661
Message ID:
00362707
Vues:
20
>>cGroupCode = THISFORM.text1.VALUE
>>SELECT * FROM client ; <
>>WHERE group_code = cGroupCode ; <
>>INTO CURSOR Mycursor <
>
>** Shouldnt _TALLY go here?
>
>>REPORT FORM POLICY.FRX FOR GROUP_CODE = cGroupCode PREVIEW
>
>** Why the FOR GROUP_CODE here? You already found those records in Mycursor.
>

None of this code was mine, so I'd refer you back to the author, since I'd not written the code.

>>This is asking for trouble - using a REPORT FORM based on a FOR in conjunction >with a PREVIEW may result in the filter not being applied if the user decides >to print. Either do a SELECT to a cursor, or use a P-view as the basis of the >report (if you inherit from the current DE and you need the detail to have the >name of the base table, you can always open the P-view with an ALIAS) so that >you don't run into this particular trap
>
>>IF _TALLY !=0
>> wait window 'FOUND MATCH, WILL PRINT REPORT '
>>ELSE
>> wait window 'NO DATA MATCH, TRY AGAIN '
>>>>ENDIF
>>
>>RETURN
>
>>Burp - the cursor MyCursor's FOR clause just became invalid, since cGroupCode >just went out of scope.
>
>**What do you mean? The cursor is already made at this point isn't it?
>**How does cGroupCode go out of scope?
>

cGroupCode is scoped as a PRIVATE or LOCAL variable, unless it's defined as a PUBLIC. THe variable is released on exit from the module that declares it. OTOH, the cursor persists beyond the module - and any requery of the cursor after the RETURN will cause the requery to fail, since the basis of the WHERE clause is no longer valid.

>>Try converting the SELECT to convert cGroupCode to a literal with macro->expansion and quote encapsulation as shown below:
>
>>SELECT * FROM client ;
>>WHERE group_code = [&cGroupCode] ;
>>INTO CURSOR Mycursor
>
>**I've never seen a literal with macro-expansion and quote encapsulation. Is this all really necessary?
>

The definition of a literal doesn't go away. You convert the memvar reference which does go away to a literal by this.

>Thanks. Just trying to follow along here.
>BTW, can I carry over the text I'm replying to without having to cut and paste?
>John
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform