In the loading form Init event there is a SELECT command to select Alias2
SELECT (Alias2)
But after executing that SELECT command
still the selected alias is "Alias1"(Grid RecordSource)
What is the reason for this?
How to avoid this?
Pls help.
That's how the Grid class behaves - it's notoriously trying
to keep its RecordSource alias being the currently selected
work-area.
> How to avoid this?
You can probably either use a private datasession for the
second form.
Or move the "focus" elsewhere, e.g. in first form do a
"Thisform.dummy.SetFocus()".
In addition, in many scenarios the effect may not matter
much, since custom code works better if it does not rely
on the current work-area being a certain alias anyway.
IOW, better do not omit the IN clauses, alias parameters,
that many Vfp commands and functions have.
hth
-Stefan
Yes I can use Alias name in some functions
But how to give the alias name for following commands?
lcRelation = SET("Relation")
SET RELATION TO
"Stefan Wuebbe" <stefan...@gmx.de> wrote in message
news:uSlqQSVf...@TK2MSFTNGP06.phx.gbl...
Since you can have multiple Relations going into different child tables, the
use of SET("RELATION") is not the correct way to retrieve your existing
relations. That SET() could only return one of that settings. That's why
"RELATION" is also not listed in the Intellisense Dropdown list for possible
SET() parameters.
You can get a correct answer using the RELATION() function, which is also
equiped with an ALIAS parameter. That function, btw is also listed as SEE
ALSO in the SET RELATION command help.
A little more complicated is the second command. The correct command here
would be SET RELATION OFF, but that one somehow didn't got the "IN cAlias"
extension.
The other SET RELATION TO would have the IN clause, but the correct syntax
is a little bit tricky:
SET RELATION TO IN cMasterAlias
will get you an error. But this one works:
SET RELATION IN cMasteralias TO
But again: The better way would be to use a Private Datasession in your
childform. You would need to transfer the current recordnumber as parameter
to that form, so that it knows which record you're sitting on in the master
form.
--
wOOdy
Visual FoxPro Evangelist
Microsoft "Most Valuable Professional" 1996 to 2009
"*��)
�.���.�*��) �.�*�)
(�.��. (�.�` *
..�`.Visual FoxPro: It's magic !
(�.�``��*
"J�rgen Wondzinski" <jue...@wondzinski.de> wrote in message
news:%23yJVlDX...@TK2MSFTNGP06.phx.gbl...
> "*��)
> �.���.�*��) �.�*�)
> (�.��. (�.�` *
> ..�`.Visual FoxPro: It's magic !
> (�.�``��*
>