×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

object formName not found

object formName not found

object formName not found

(OP)
Hi:

I am going back and forth between 3-4 forms and I at times I get an error saying 'formName is not an object'.  I am issuing Do form formName.  Individual forms seem to work fine when I run them from the project manager.  Any help appreciated.

Thanks

RE: object formName not found

Have you observed any pattern in the errors; like not happening the first time you start a given form, or only happening when you already have two forms open?  

Are these forms you created in the form designer?  Could you possibly have a variable you named the same as a form?  What version and service pack of VFP do you have?  Are all the forms added to your project?

Dave Dardinger

RE: object formName not found

asm338s

If you are going back and forth between the forms, why not instantiate them and thereafter either minimize or use .Hide() in the .LostFocus events of the individual forms, if you don't want them to be visible.

In the code used to call a form put:-

IF VARTYPE(oForm2) = [O] && Forms exists
    .oForm2.Show() && or .oForm2.WindowState = 0
ELSE
    DO FORM form2 NAME oForm2 LINKED
ENDI

When you release a form, put:-

RELEASE oForm2 && Release object reference

By having on object reference, it also gives you access to all the properties, events and methods of any form regardless of where you are.

Chris

RE: object formName not found

asm338s

Apologies

.oForm2.Show() && or .oForm2.WindowState = 0

should be:-

oForm2.Show() && or oForm2.WindowState = 0

Chris

RE: object formName not found

asm338s

Brain in failure mode today

When you release a form, put:-

RELEASE oForm2 && Release object reference

in the .Destroy event of the form

Chris

RE: object formName not found

(OP)
Hi Brian:

Thanks for you help.  I tried doing all that.  Now when I click on anything that particular form loads and disappears in a flash.  

asm338s

RE: object formName not found

asm338s

Could you explain in more detail what is happening, please?

Chris

RE: object formName not found

(OP)
Everytime I call a form I wrote the following code:
IF VARTYPE(oForm2) = [O] && Forms exists
    oForm2.Show() && obj. ref. for the form                   
ELSE
    DO FORM form2 NAME oForm2 LINKED
ENDIF

Everytime I close a form in the destroy event I wrote:
Release oForm2

Now when I click on my toolbar or the menu to load this form it the form window appears and then disappears.  I can't see any data on the form but I can tell from the borders that it was the right form.  I am not getting anymore "object not found errors".   

Thanks for your help.

RE: object formName not found

(OP)
I just took the linked keyword out and now I can view my forms.  I get the object not found error when i try to select a value from a combo box on the form and try to use it in the sql statement.  After giving the error the sql statement executes correctly.  I don't get any errors when I run the forms indiviually.

RE: object formName not found

asm338s

If the problem persists, post your SQL statement.

Chris

RE: object formName not found

I'm actually having a similar problem.

I have a main form set as show as top level form

and 3 other forms that are show in top level form.

when switching from one particular form to another particular form, I get the 'Object FormName is not found'

and the error occurs on a go top statement for a table in the Init event of the form I'm switching to.  The error refers to the form I'm switching from.

I've used the same code as a template for one of my other projects and that project works fine.

RE: object formName not found

(OP)
Here is the SQL statement.  I click on a command button on the form 'arcrpts' and then it calls the specified procedure in the program.
  
select * from clmlvl where (pkey in (select pkey from ipclm)) and alltrim(provider)=arcrpts.provnocbo.value into table clm2

I get this error everytime I refer to anything like arcrpts.*.*

Thanks for taking the time to help.
 

RE: object formName not found

(OP)
Here is the SQL statement.  I click on a command button on the form 'arcrpts' and then it calls the specified procedure in the program.Following is one of the erroneous SQL statement:
  
select * from clmlvl where (pkey in (select pkey from ipclm)) and alltrim(provider)=arcrpts.provnocbo.value into table clm2

I get this error everytime I refer to anything like arcrpts.*.*

Thanks for taking the time to help.
 

RE: object formName not found

asm338s

It would appear you are using the form title arcrpts instead of the the object reference name of the form.

If the form arcrpts has the object reference name oArcrpts, the the code would be

select * from clmlvl where (pkey in (select pkey from ipclm)) and alltrim(provider)=oArcrpts.provnocbo.value into table clm2

Chris

RE: object formName not found

(OP)
I get the same error after I use the object refernce.  I don't know why I need to use that because I am not Lilnking the object reference to the form name because if I do that than I cannot view my forms.
I was thinking about storing the value in a public variable and using that instead of arcrpts.provnocbo.value.  

RE: object formName not found

asm338s

In your third post you wrote-

Everytime I call a form I wrote the following code:
IF VARTYPE(oForm2) = [O] && Forms exists
    oForm2.Show() && obj. ref. for the form                   
ELSE
    DO FORM form2 NAME oForm2 LINKED
ENDIF

Everytime I close a form in the destroy event I wrote:

Release oForm2

What should have been happening is that oForm2 should have replaced by the object reference for the particular form.

If you have literally used the code you posted in the various .Destroy events, then clearly there will have been a problem in implementing the use of an object reference.



If you consult the help file for DO FORM, you will find the following:-

If you omit the NAME clause, Visual FoxPro creates an object type variable with the same name as the form or form set file.

Your code:-

select * from clmlvl where (pkey in (select pkey from ipclm)) and alltrim(provider)=arcrpts.provnocbo.value into table clm2

would indicate that is what you are trying implement?

Chris

RE: object formName not found

asm338s

If you have literally used the code you posted in the various .Destroy events, then clearly there will have been a problem in implementing the use of an object reference

should be

If you have literally used the code you posted in the various events, then clearly there will have been a problem in implementing the use of an object reference

Chris

RE: object formName not found

(OP)
Hi Chris:

Now I am only using Do form formName
and in the destroy event I put:
Release formName.
Is this what you were trying to say.
I am still getting the same errors though.  

RE: object formName not found

I just took the linked keyword out and now I can view my forms.

I read that to mean that you were using the code

DO FORM form2 NAME oForm2

If you omit the NAME clause, Visual FoxPro creates an object type variable with the same name as the form or form set file.

The statement is correct but can be misleading, as your object reference arcrpts is out of scope in your SQL statement, hence the error.

As the use of LINKED appears to cause you a problem, try

DO FORM form2 NAME oForm2

and then

select * from clmlvl where (pkey in (select pkey from ipclm)) and alltrim(provider)=oForm2.provnocbo.value into table clm2

If it continues to go out of scope, declare oForm2 a PUBLIC variable before using it.

Chris







RE: object formName not found

(OP)
Thanks Chris for bearing with my 18 responses.  I finally got it working.

Asm338s

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close