Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting data for grid
Message
From
09/11/1997 15:24:24
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00059166
Message ID:
00059184
Views:
26
>>I have the following scenario:
>>I have a form (lets say Form1) where users can fill in the name, firstname... of a person. To check, if this person already exists, I want to start another form (lets say Form2) and display the "double" persons. I do this with a button in Form1 and the following click-event:
>>
>>DO FORM .\MASKEN\DOUBLE.SCX WITH ALLTRIM(lcName)
>>
>>I pass along a parameter with the lastname of the person.
>>In the init-event of Form2, I have the following code:
>>
>>PARAMETERS lcDoubleSeek
>>lcSuche = lcDoubleSeek
>>
>>If I understand VFP, I now have the lastname in lcSuche.
>>
>>In Form2, I have a grid and I want it to display the double persons. So I put the following code in the init-event of my grid:
>>
>>SELECT name, vorname ;
>> FROM person ;
>> WHERE ALLTRIM(name) = lcSuche ;
>> INTO CURSOR cDouble
>>
>>The grid has the following properties:
>>
>>RecordSource: cDouble
>>RecordSourceType: 1-Alias
>>
>>I hoped that the grid would display the desired data - but it doesn't.
>>It displays data from another table (one from the dataenvironment for Form1), for Form2 I have defined no DataEnvironment.
>>
>>What am I making wrong ?? What have I to do that Form2 display the correct data ?
>Christian,
>
>First your variable lcSuche goes out of scope when the form's Init mehtod ends so it doesn't exist beyond that point. Secondly the grid's Init fires before the form's Inti fires so the parameter has no yet been received when the grid fires its init. To do what you want you could do this;
>
>Make your grid with no RecordSource and a recordsourcetype of Alias.
>
>In the form's Init you;
>
> LPARAMETERS pcSuche
> SELECT name, vorname ;
> FROM person ;
> WHERE ALLTRIM(name) = pcSuche ;
> INTO CURSOR cDouble
> THISFORM.Grid1,RecordSource = "cDouble"
> THISFORM.Grid1.Refresh()
Jim,

thanks for your tip - works fine :-)

Christian Kirn
Previous
Reply
Map
View

Click here to load this message in the networking platform