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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set frm = me with calling a public form sub.

Status
Not open for further replies.

markphsd

Programmer
Jun 24, 2002
758
US
I set a form to a public object called poForm and then I can call a sub from that object such as poForm.mySub

It works most of the time, but then I start to get Application-Defined or object error messages.

I can still call the sub this way Forms!myForm.mySub

What would cause this?



Mark P.
Providing Low Cost Powerful Point of Sale Solutions.
 
Shorter and easier to declare a public object so i can write: myform.mysub. This is certainly the case when i ever deal with subforms. forms!myform.form!myssubform.mysub just is more complicated then mysubform.mysub. Also, i do it all the time,it's just on one form the publicly declared object seems to break and i can't refer to it anymore.



Mark P.
Providing Low Cost Powerful Point of Sale Solutions.
 
yes, that's the funny thing about ..

such as:

if not myform is nothing then

else
msbgox "Hey your form is nothing!."
end if


it not that it's not instantiated. I've only had this same error when i mispell the sub, or i don't include the variables that i'm supposed to pass.

Mark P.
Providing Low Cost Powerful Point of Sale Solutions.
 
markphsd . . .

I had my other posts removed due to misinterpretation of your post origination. Now that I'm on track . . . some questions:
[ol][li]Were in the DB do you [blue]declare the public object?[/blue]
Post that line of code.[/li]
[li]Where in the DB do you [blue]set the public object?[/blue]
Post that line of code[/li]
[li]Where in the DB do you [blue]call the routine?[/blue]
Post the calling code.[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
I declare the public object in a module. I set from within the form onload event.

I create a public sub in the form that I can call.

I call it whereever I want to, usually in a module, but sometimes from other forms.

The only time I clear the object is on the close event of the form. Also, the during the duration of the application being open the object is not cleared, nor is the form closed; I can check it by seeing if it "is nothing."

At some point the object becomes unusable. I can't refer to objects on the form, and I can't call the sub.

I haven't pinpointed when it becomes unuseable. I'm having a hard time doing that because I dont' want to not suppress errors in the production environment. I'd rather just find it with testers. If I run the program for a while on my own computer It comes up after a while, and it doesn't seem to have a certain location of error.

Mark P.
Providing Low Cost Powerful Point of Sale Solutions.
 
Remove the second line of the last post. I don't see the edit thread link anymore on here.

Mark P.
Providing Low Cost Powerful Point of Sale Solutions.
 
markphsd . . .

Is this a form that stays open?

Have you tried compact & repair?

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top