Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 5.0 - Record Pointer Moves when another form calledH
Message
De
18/08/1997 15:58:42
 
 
À
18/08/1997 15:52:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00045357
Message ID:
00045372
Vues:
44
>>>>>I hope someone can help me.
>>>>>
>>>>>Form A
>>>>>- private data session
>>>>>- table 1 with buffer mode 5
>>>>>- table 2 with buffer mode 5
>>>>>- a one to many relation set in a grid object on Form A relates Table 1 to Table 2.
>>>>>- a command button that adds a record to Table 1 then to Table 2 and calls Form B.
>>>>>
>>>>>Form B
>>>>>- default data session
>>>>>
>>>>>
>>>>>Problem: When I add a record to Table 1 then to Table 2(parent child records) and then call Form B to fill in information in Table 2 record VFP moves the record pointer in Table 2 during the call of Form B. I have tried everything I can think of to fix problem. If I turn off the relation in the grid object and then run it works fine but I need to have in enabled to display records properly. If someone else has had this problem please reply.
>>>>>
>>>>>Mike Laubach
>>>>>mlaubach@mt-solutions.com
>>>>
>>>>Did you try this construction just to make sure that situation is clear?
>>>>
>>>>Select Table2
>>>>nRecno=recno()
>>>>do form B && I guess it's modal form
>>>>Select Table2
>>>>go nRecno
>>>>
>>>>The second thought: if you somehow move pointer in table A (during the call), pointer B will shift automatically, because of temp repationship.
>>>
>>>No the pointer is not being move by me anywhere. Basically the code looks like this:
>>>
>>>commandbutton.click
>>>-------------------
>>>insert into table1 .....
>>>insert into table2 .....
>>>
>>>do form formb
>>>
>>>
>>>By the time execution reaches the init event in formb the record pointer in table2 has moved. I have even have gone so far as to send the record pointer table2 should be at to formb and set it in the init but still did not work. As soon as the init code finished executing it would move the pointer again. Anymore help would be greatly appreciated.
>>>
>>>Mike Laubach
>>>mlaubach@mt-solutions.com
>>
>>I understand that moving a pointer by unknown reason is unpleasant to see, but you could restore pointer when Form A will reacquire focus, and nobody will care about behind-the-scene manipulations. If Form B is modal just Go nRecno after Do Form... If it's modeless, restore pointer in FormA.Activate Event.
>
>The problem is not where the record pointer is after returning from FormB but where the record pointer is once FormB is executed. FormB prompts user for some information that is saved in Table2. If the record pointer is not on new record then the new information will overwrite another record.
>
>Mike Laubach
>mlaubach@mt-solutions.com

Ok, and this problem can be handled too, regardless real pointer place. You could add parameters calling Form B, e.g. Do Form B With Table2.Primarykey. When you want to retrieve information from the table (being in FormB), you fire code like:
Select Table2
Set order to tag Primarykey
Seek Thisform.Table2key && table2key is form property set to accepted parameter value in FormB.Init.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform