Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
My view keeps moving to its last record
Message
From
26/01/2001 09:31:41
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00468962
Message ID:
00469016
Views:
15
Thanks Vlad

My last responce was incorrect. There is no problem with V_invited being requeried.

After reading your post I decided to check my calculate command one last time.
I put some wait windows in to check the value of V_ticket.Ticket so I could see it change.

code was

=requery('v_invited')
go top in v_invited

wait window v_ticket.ticket+'After requery at end of init of init'

Calculate CNT() to Thisform.fancycount.banner FOR v_invited.INVITED

wait window v_ticket.ticket+'At end of init of init'


For some reason this calculate command is moving my record pointer in V_ticket even though its alias is set to V_invited.

Maybe thisform.fancycount.banner has an assign method on it or something.





>Hi!
>
>I have following suggestions.
>
>1. Check if your Form2 have objects in the form's data environment.
>2. try to rebuild form2 from scratch or open SCX file as DBF and delete all orphan records that might be left after form's data environment. Don;t forget to pack it after deletion. (Do backup of your form before such actions).
>3. You Form2 have controls that use comands or properties that cause record move in the cursor. these might be:
>- Grid without record source defined. It than uses current record source by default causing some weird results
>- combo box or list box with row source as alias - causes record move in that alias
>- commands like SUM, COUNT and others cause record to move to the end of alias.
>
>I never had such weird behavior at all. Somthin must cause this, VFP does not moves record spontaneously just because form opened.
>
>To catch what changes record pointer, do following:
>
>Put SET STEP ON in the code just before running of form 2, compile project with debug information if you run it as EXE. Run EXE from VFP design mode. Than when program stops, add into whatch window entry:
>recno("MyView")
>
>Click to the left of this entry in the watch window, red dot should appear to indicate breakpoint by value change. Continue program running. Program should stop at the code line that causes recno() change. If you get stops 'between' code line running, obviously this because recno() changed by some object initialization (grid or combo/list boxes as mentioned before). In such case you need to run program again and do step-by-step code running to see which object initialization causes problem. You might also remove objects one by one from form and see by such way which one spoils things.
>
>Just debugging experiense ;)
>
>HTH.
>
>>Ok I know that I should have used a private data environment but......
>>My view (v_ticket) keeps moving to its last record
>>
>>I have a form (form1) that uses the public data environment.
>>this form manages the table v_ticket.
>>
>>It calls another form (form2) which also uses the public data environment.
>>
>>Form2 does not attempt to establish its own environment and has datasession set to public.
>>
>>Form2 has a listbox on it that has nothing to do with v_ticket.
>>
>>when the init event for my first object on form2 runs, the record pointer in v_ticket jumps to the last record.
>>
>>This appears to be a sign of V_ticket getting requeried but I am not sure thats what is happening.
>>
>>I suppose I can bodge my way out of the problem this by putting the record pointer back to where it should be but I wondered if someone can explain to me what is happening here.
>>
>>I dont want to change the code to work with a private data session unless I have to because the form2 makes many references to a record in v_ticket.
>>
>>Any help at all much appreciated
Previous
Reply
Map
View

Click here to load this message in the networking platform