Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 5.0 - Record Pointer Moves when another form calledH
Message
From
18/08/1997 16:30:41
 
 
To
18/08/1997 16:23:24
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00045357
Message ID:
00045387
Views:
62
>>>>>>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.
>>>>
>>>>I have already tried this but by passing the record number of the record that it should be set to. But it still does not work.
>>>>
>>>>insert into table2 ....
>>>>x = recno('table2')
>>>>do form formb with x
>>>>
>>>>formb.init
>>>>----------
>>>>parameter pn_recno
>>>>
>>>>select table2
>>>>go pn_recno
>>>>
>>>>Mike Laubach
>>>>mlaubach@mt-solutions.com
>>>
>>>No. Save pn_recno in Thisform.newproperty and use go Thisform.newproperty immediately before you retrieve data from the table (e.g. in Form.Activate event). It must work...
>>
>>But I am worried about where the record pointer is in FormB not in FormA. When I go to save information in Formb that is where the problem is because it is not on the newly inserted record.
>>
>>Mike Laubach
>>mlaubach@mt-solutions.com
>
>When you accept parameter (Form.Init) you get exact pointer you need in. So, save this pointer immediately into form property and use its value to reset pointer any time you worry about exact table pointer location. It may look cumbersome, but it's the only way to make your code error-proof.

I understand what you are saying and that is exactly what I am doing. I have to set the record pointer in the init method because some of the controls on FormB are tied to table2. Another very interesting point about this problem is that if I remove the relation from the grid object on FormA then it all works as planned. The relation is a key that links the parent table(Table1) with the child table(Table2).

I have been programming in Xbase for 10 years and this is one of the strangest bugs I have ever seen.

Mike Laubach
mlaubach@mt-solutions.com
Mike Laubach
IP Services Inc
mlaubach@ipserv.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform