Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form object not found 1

Status
Not open for further replies.

spuppett

Programmer
Jan 25, 2003
48
0
0
US
I'm using VFP 6.0

I have a form that I open up from a program.
Code:
DO FORM frmAudit

When I get to that section in the code, I get an error saying:
Object FRMAUDIT is not found

If I cancel the error and exit out of the form and re-run the entire program, it will work just fine, or if I run the form from the command window, everything works OK.

Any suggestions on how to fix this?
 
First, have you traced to be sure that the problem is on the DO FORM command, not one that follows?

The error sounds like perhaps you're running the form and then referencing it as frmAudit in subsequent commands.

Tamar
 
Well it looks might it may be in the form its self. The DO FORM is the last line in the program. In the Activate for the form I add a number of entries into a combo box with this
Code:
this.cboBranches.addItem('Austin')
...

I'm assuming that is the first part of the form that is executded.

Later in the form I do this:
Code:
IF ISBLANK(frmAudit.cboBranches.text)

I tried to use this, but it didn't like that, I also tried leavin off the frmAudit. Any thoughts??

I'm more of a VB guy and don't really know to much about the visual side of VFP.
 
Just change this:

IF ISBLANK(frmAudit.cboBranches.text)

to this:

IF ISBLANK(THISFORM.cboBranches.text)

The problem is that frmAudit is the name of the form's file, not the form's name property. There is an important distinction. THISFORM is a generic object that always refers to the current form.

By the way, it's usually better to use a control's Value property rather than its Text property, although that's got nothing to do with this particular error.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I think Mike is on spot. The error in the code leads to your confusion. When an error exists in the form, the instantiating will not take place.

For example.. in the frmAudit, if you add the code..

Code to be added in the Error event of the frmAudit..
**********************************************
PROCEDURE Error
LPARAMETERS nError, cMethod, nLine

=MESSAGEBOX([Error Number = ] + STR(nError) + CHR(13) ;
+ [Error Method = ] + cMethod + [ in Line ] ;
+ STR(nLine)

ENDPROC
**********************************************

The code only will help to run the form reporting the error and also helps continuing with error. Anyway, you have to fix the problem, but it guides you where the problem is.

You can add this code in all your forms or add it in your base form which is subclassed for your application.

Cheers :)

____________________________________________
ramani - (Subramanian.G) :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top