I may be a  little late on this thread but this is how I do it:
I set a form property in form1 called nRec which captures the recno() you are 
positioned in:
thisform.nRec = recno('yourcursor')
you set a new property in that form called nRec_1
When you call form2:
do form2 with thisform.nRec to thisform.nRec_1

In the init event of form2:
lparameters pnRec
(you also set a property called nRec or whatever you like in form2, to receive 
the number of the record in form1)
thisform.nRec = pnRec
in the activate event of form2:
select thecursorlocate for recno() = thisform.nRec
In this way, form2 is positioned in the same record you are positioned in form1
(I assume you examine the record in a grid here)

in the afterrowcolchange event of the grid
thisform.nRec = recno('thecursor')

If you were to move the recordpointer in form2, or even if you weren't, its 
unload event should have the following code:

return thisform.nRec
Now, back to form1In its activate event do this:
select yourcursorlocate for recno() = thisform.nRec_1 
So now, the record pointer is in the same record that form2 is in.
In your particular case you might want to add some control property to avoid 
error in the activate event of form1, such as:
if (condition)
    select yourcursor    locate for recno() = thisform.nRec_1 
endif
Needless to say that both forms should have private data sessions
Hope it helps
Rafael Copquin
 

    El Martes, 1 de marzo, 2016 3:30:05, Darren <fox...@ozemail.com.au> 
escribió:
 

 Joe if you want it zip it all up and send it to me I'll have a look see for
you.

-----Original Message-----
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Joe
Yoder
Sent: Tuesday, 1 March 2016 4:33 PM
To: profoxt...@leafe.com
Subject: Re: How to allow multiple forms to update the same record pointer
in a table

I use a test button on the main form to set the record pointer to 25.  As
soon as I step into either of the Do Form lines the recno() changes back to
a red 1 without the watch firing. The debugger shows that it is still in the
click method of the command button that did the call.

There must be something I as a dabbler am doing differently than experienced
developers - what can it be?

I have changed everything except the data file I am trying to display and
the behavior persists.  Perhaps tomorrow I will use a different data file as
well.

Thanks to all for the input so far!

Joe

On Mon, Feb 29, 2016 at 9:21 PM, Darren <fox...@ozemail.com.au> wrote:

> Put the SET STEP immediately before the do form.
>
> Then on the toolbar click on the symbol with the arrow going into the 
> brackets. Do that repeatedly and you'll go one line at a time. You'll 
> get the idea.
>
> -----Original Message-----
> From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of 
> Joe Yoder
> Sent: Tuesday, 1 March 2016 1:15 PM
> To: profoxt...@leafe.com
> Subject: Re: How to allow multiple forms to update the same record 
> pointer in a table
>
> Thanks to your instructions I have done that and see that the pointer 
> changes as soon as the "do form" line executes.  I haven't figured out 
> how to single step in the called form code. - Joe
>
> On Mon, Feb 29, 2016 at 7:59 PM, Darren <fox...@ozemail.com.au> wrote:
>
> > One way ...
> >
> > SET STEP ON in the code that calls the 2nd form.
> >
> > Go into the breakpoints setup.  (Little hand symbol) Add a 
> > breakpoint
> > - Type = "Break when expression has changed"
> > In the expression put in RECNO ("<ALIAS>") The go back the command 
> > window and type in RESUME.
> >
> > Something like that should get you going.
> >
> > -----Original Message-----
> > From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of 
> > Joe Yoder
> > Sent: Tuesday, 1 March 2016 11:38 AM
> > To: profoxt...@leafe.com
> > Subject: Re: How to allow multiple forms to update the same record 
> > pointer in a table
> >
> > I'm afraid I have forgotten the little I knew about setpoints and 
> > stepping in the debugger.  I guess I need to read up on that. - Joe
> >
> > On Mon, Feb 29, 2016 at 7:36 PM, Joe Yoder <j...@wheypower.com> wrote:
> >
> > > Thanks for the idea Kurt but that was one of the first things I
> checked.
> > >
> > > I have now determined that any form I call from the main form will 
> > > always start at record 1 even if the record pointer is at a 
> > > different value just before the call.  If the called form changes 
> > > the record pointer the pointer value will persist after the form 
> > > closes.  I have added a button to simply browse the table from the 
> > > main form.  That action respects the value of the pointer on entry 
> > > and leaves the pointer
> > in the proper place on exit.
> > >
> > > There must be something about the forms I am using that causes 
> > > this problem.  I've been looking at the scx files and see that 
> > > there is a some information about a cursor there.  Is there a 
> > > setting I need to change to get the behaviour I need?  (I have 
> > > done a test project where there is only one table and the behavior 
> > > continues.)
> > >
> > > Thanks for any ideas,
> > >
> > > Joe
> > >
> > > On Mon, Feb 29, 2016 at 11:31 AM, Kurt Wendt 
> > > <kurt_we...@globetax.com>
> > > wrote:
> > >
> > >> Just a WAG - but, what is your DataSession property value for the 
> > >> Form? I think it should be set to "1-Default Data Session". That 
> > >> may be your problem if it says Private!
> > >>
> > >> Regards,
> > >> Kurt Wendt
> > >> Consultant
> > >>
> > >>
> > >> Tel. +1-212-747-9100
> > >> www.GlobeTax.com
> > >>
> > >>
> > >> -----Original Message-----
> > >> From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf 
> > >> Of Joe Yoder
> > >> Sent: Monday, February 29, 2016 10:22 AM
> > >> To: profoxt...@leafe.com
> > >> Subject: Re: How to allow multiple forms to update the same 
> > >> record pointer in a table
> > >>
> > >> Thanks Kurt - your understanding is correct.
> > >>
> > >> I have pinned down the problem to the detail form.  When I call 
> > >> it something changes the record pointer to the first record.  
> > >> When the calling form gets control back the record pointer is 
> > >> where the detail
> > form left it.
> > >>
> > >>
> > >> I have not been able to find any reason for this but wonder if it 
> > >> is related to the fact that the form was first created using the 
> > >> form
> > wizard.
> > >> I had grief with changing the table alias with that form so I 
> > >> opened a new form and copied the complete layout.  That took care 
> > >> of table name but perhaps there is an "unwanted feature" still in 
> > >> place from its former life as a wizard created form.  I'd rather 
> > >> not do the tedious work of regenerating the form - any ideas?
> > >>
> > >> Thank you,
> > >>
> > >> Joe
> > >>
> > >> On Mon, Feb 29, 2016 at 9:21 AM, Kurt Wendt 
> > >> <kurt_we...@globetax.com>
> > >> wrote:
> > >>
> > >> > Fernando - that's just the opposite of what Joe wants. He 
> > >> > indeed wants Both forms to be looking at the same records - 
> > >> > such that if he brings up the 2nd form - and Changes to a 
> > >> > different record - then upon returning back to 1st form - it 
> > >> > should now be looking at the Same record that Form2 was pointing
to!
> > >> >
> > >> > Regards,
> > >> > Kurt Wendt
> > >> > Consultant
> > >> >
> > >> >
> > >> > Tel. +1-212-747-9100
> > >> > www.GlobeTax.com
> > >> >
> > >> >
> > >> > -----Original Message-----
> > >> > From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On 
> > >> > Behalf Of Fernando D. Bozzo
> > >> > Sent: Monday, February 29, 2016 1:16 AM
> > >> > To: profoxt...@leafe.com
> > >> > Subject: Re: How to allow multiple forms to update the same 
> > >> > record pointer in a table
> > >> >
> > >> > Hello joe:
> > >> >
> > >> > You may need to use private session en form 2 or on both, so 
> > >> > record pointers do not interfere between forms.
> > >> >
> > >> >
> > >> > --- StripMime Report -- processed MIME parts ---
> multipart/alternative
> > >> >  text/plain (text body -- kept)
> > >> >  text/html
> > >> > ---
> > >> >
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/1530341287.1483853.1456818286030.javamail.ya...@mail.yahoo.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to