frm as form problem

John Sh

Active member
Local time
Today, 18:36
Joined
Feb 8, 2021
Messages
612
Hi All. I need to pass a form object from one function to another. The first function has the variable defined as (frm as form).
How do I pass this variable to a second function called by the first. The second function obviously cannot define it as { frm as form).
Also how can i read the value of "frm" whilst stepping through the functions. If I hover over "frm" there is no response.
As always, your replies are appreciated.
 
The first function has the variable defined as (frm as form

When you say "variable" do you mean as a parameter between the brackets after the function name?

You can pass forms objects, anything really, from one function to another, within these parameters.
 
There's an example of passing a form as a parameter within a function on my website here:-


Look in the class module code for the function:- "fGetAssociateCtrl"
 
Last edited:
You are confusing formal and actual parameters.

The variable names appearing in parentheses during the function declaration are the FORMAL parameters. Those names ONLY apply inside the scope of the function's declaration and they vanish with the End Sub or End Functin that ends this routine. It does not matter what names are used in the function call, because those names are the ACTUAL parameters and are NOT in the scope of the function.

So yes, you can re-use names.
 
If I hover over "frm" there is no response.
Because how can a control tip text represent anything that can't be represented with the text of the control tip text?
If you set frm as a Form object and then had a line of code that referenced it's .Name property, then the control tip text that appears when hovering might be useful
 
Thank you all for your replies. I do, however, owe you all an apology.
My lifetime as an electronics technician taught me that multiple fault indications generally come from a single source.
In coding, just the opposite is the case. An apparently single problem has many possible causes.
My error was to attribute a bunch of strange happenings to a single source while, in fact, there were many obscure little errors in inherited images and excel data files. These conspired to indicate a problem with the "frm as form" declaration, thanks to my background.
I readily admit to being very much a novice in VBA coding so my sincere apologies to all.
John Sh.
 
Thank you all for your replies. I do, however, owe you all an apology.
My lifetime as an electronics technician taught me that multiple fault indications generally come from a single source.
In coding, just the opposite is the case. An apparently single problem has many possible causes.
My error was to attribute a bunch of strange happenings to a single source while, in fact, there were many obscure little errors in inherited images and excel data files. These conspired to indicate a problem with the "frm as form" declaration, thanks to my background.
I readily admit to being very much a novice in VBA coding so my sincere apologies to all.
John Sh.
Sounds like you got it all sorted out. Good luck with your project.
 
Sometimes even a person like me, with 50+ years of total programming experience, will incorrectly chase down errors just because it is so easy to do. You DO know the true meaning of "experience" don't you? It is the ability to recognize your mistakes when you make them again.
 
Unfortunately 80 + years of "experience" is a hard thing to buck!
 

Users who are viewing this thread

Back
Top Bottom