Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object not found error
Message
From
23/03/1999 14:58:47
 
 
To
23/03/1999 14:54:22
Alp Berker
Defense Finance and Accounting Services
Indianapolis, Indiana, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00200981
Message ID:
00201141
Views:
13
>>>>>>>I am having a problem with my form defaults after i run a report after opening a grid.
>>>>>>>the code I have in the click button for the browse grid:
>>>>>>>
>>>>>>>public nOldrec
>>>>>>>THISFORM.appfindbutton.MousePointer=11
>>>>>>>oAgp = CREATEOBJECT("APPGRIDPICK")
>>>>>>>oAgp.Show()
>>>>>>>report form license.frx preview
>>>>>>>GO nOldRec
>>>>>>>THISFORM.appfindbutton.MousePointer=1
>>>>>>>THISFORM.Refresh()
>>>>>>>
>>>>>>>after this codes executes and I want to move forward within the database with my forward command button I get the error message
>>>>>>>Object X is not found.
>>>>>>>X= is the name of the form.
>>>>>>>Apparently the form object is not getting reset after I run the report, how can I remedy this so it gets reset after the code is run?
>>>>>>>Any help would be appreciated.
>>>>>>>thanks,
>>>>>>>
>>>>>>>Alp Berker
>>>>>>>Systems Analyst
>>>>>>>Conseco Inc.
>>>>>>
>>>>>>Could you post the code which actually triggers the error? Also, what is oAgp? Another form?
>>>>>
>>>>>Sure Edward,
>>>>>&cCmdObj..cmdnavigate.Next.enabled = .T.
>>>>>where &cCmdObj in the macro substitution has a value of x, the name of the form.
>>>>>oAgp is a form defined in a class. I am instantiating the form to display the grid class.
>>>>>sorry for not being more specific.
>>>>>regards,
>>>>>
>>>>>Alp Berker
>>>>>Systems Analyst
>>>>>Conseco Inc.
>>>>
>>>>Bacically, you cannot use constructions like Myform.cmd...., because Myform is not always the correct reference to the form's object. When you outside a form and want to refer to it, you should either path Thisform to this snippet (e.g. procedure) or have some mechanism to find the proper object reference, e.g. searching through _SCREEN.Forms collection.
>>>
>>>Edward,
>>>I don't think I am going outside the form. The command button calls a utility program which executes the above code. I believe when the report is run, the deafaults are lost since the report form.. destroys the defaults. Apparently the report makes it loose the form name. the other buttons when used work fine,
>>>only this button looses the form object name.
>>>So I believe you are saying insert thisform an assign it to x (where x is the form name) before it executes this code? as in
>>>thisform.x? before the code.
>>>thanks for the clarification and help.
>>>regards,
>>>Alp Berker
>>
>>If you run code inside the form (method/event) then you use Thisform. If you cannot use 'Thisform' it indicates that you outside the form and this case cannot rely on Form.Name. I do not quite understand how your interface works, but if you cannot just fire Thisform.cmd..., so you're outside the form. Am I correct?
>
>Sorry for the confusion.
>Yes I go outside the form. I stated incorrectly above. The form calls a a procedure that is stored in a procedure file, then returns the result to the form. So I am outside the form , so I believe I need to redeclare the form name in the procedural code for it to work? How would I do that exactly?
>Thanks.

There are three ways here:
1. You pass form reference when you call the procedure
DO Myproc With Thisform
and in procedure
LParameter oForm
oForm.cmd...
It's the somplest way, probably the best for isolated procedures
2. You search through the _SCREEN.Forms collection loking for your form
FOR Each oForm In _SCREEN.Forms
IF oForm.Name=="MYFORM"
oForm.cmd...
ENDIF
ENDFOR
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform