What means vfp message: object is not contained in a form

Hi Experts

Do you know what it means and the workaround ?

"object is not contained in a form"

Amazingly it appears in a chunck of code aparently with no relation with the bug.

Thanks in advance.

Eduardo FuerteAsked:
Who is Participating?
 
pcelbaConnect With a Mentor Commented:
Yes exactly. The filter should be independent on any variable and/or object. You never know where and when it can be evaluated.

The macro substitution for a string constant is possible solution in this case but it is static. To "simulate" the dynamic behavior you have to execute SET FILTER command whenever the variable contents change.

Another option is to place the filter value into a new _screen property which is better than variable and which remains dynamic:

_screen.AddProperty("MyFilter","FilterValue")
SET FILTER TO SB_EMP = _screen.MyFilter

Above property will always exist (after the first definition) and is always visible not like variable.

BTW, if you have index on SB_EMP column then you could use SET KEY instead of SET FILTER which is much faster.
0
 
pcelbaCommented:
Do you use scope resolution operator (::) somewhere?

And what is the code executed?
0
 
Eduardo FuerteAuthor Commented:
Hello Pcelba !

I  really didn't use ::

the code is in the picture, a method from cls_db class that just pass to the next record...
img-vfp-erro.JPG
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
pcelbaCommented:
So, it seems your Command3.Click should move record pointer in current workarea.

This could also mean some Form event is trying to fire when the record pointer moves. The error could be caused by fact the "prox" method is not in a form but in some standalone class.

You may try to create a new Form method called "proxTemp" containing "SKIP" code from your picture and change the Command3.Click code to call this method instead of VCX library code. The debugger then should show what code is called on the SKIP command if you click on the "Step Into" debugger button.
0
 
Eduardo FuerteAuthor Commented:
I did that no other code, only skip... by the way the table data is filtered

The class is also used in another project with no errors in the form's init event

thisform.fodb   = CREATEOBJECT("cls_Db")

being fodb a form's property.

0
 
pcelbaCommented:
If data are filtered then what is in filter expression?
0
 
pcelbaCommented:
And also, could you print out call stack when the error occurs?

BTW, do you have some error handling procedure in your code which could save the app state when the error appears?
0
 
Eduardo FuerteAuthor Commented:
Hello

Here is the error log.
Erros-Livesp.log
0
 
Eduardo FuerteAuthor Commented:
Sorry

I've put the incorrect one, please consider this.
Erros-Livesp.log
0
 
Eduardo FuerteAuthor Commented:
Ops...

The filter:

*-- During development it's fixed in
thisform.s_emp="0000000004"

SELECT DESP
SET FILTER TO SB_EMP = thisform.s_emp
LOCATE
0
 
Eduardo FuerteAuthor Commented:
Here, again...

That's the problem:

Using the form property in the filter expression has made the "mass"

if I use

SELECT DESP
SET FILTER TO SB_EMP = "0000000004"  && instead of  SET FILTER TO SB_EMP = thisform.s_emp
LOCATE

Everithing is fine, but the filter must to be dynamic in the production system,so, to workaround I've declared m.sb_emp="" as a public variable in the main program(*) and in form method did:

(*) since m.sb_emp will be util in another contexts of the system too

m.sb_emp = thisform.s_emp

*--Despesas apenas da Empresa
SELECT DESP
SET FILTER TO SB_EMP = m.sb_emp
*--SET FILTER TO SB_EMP = thisform.s_emp
LOCATE

And everithing is fine again....

Any other suggestions ?

Thanks.
0
 
tusharkanvindeCommented:
Use macro substitution

m.sb_emp = thisform.s_emp
SET FILTER TO SB_EMP = "&sb_emp"
0
 
Eduardo FuerteAuthor Commented:
Hello

I hadn't a chance to test your solution by the way it looks fine

I guess I declare

_screen.AddProperty("MyFilter","FilterValue")
SET FILTER TO SB_EMP = _screen.MyFilter
at  the main prg

One last thing what does "BTW" means ? (it sounds like an Aircraft Company, rsrs)

 
0
 
pcelbaCommented:
BTW menas "By the way" in this context. It is common SMS (Short Messaging Service) abbreviation used in e-mails also.

More details: http://en.wikipedia.org/wiki/SMS_language
This is also interesting: http://www.abbreviations.com/BTW
0
 
Eduardo FuerteAuthor Commented:
Good... I'm planning next semester to return to my English classes.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.