Set statement (setting a form name as a variable)

  • Thread starter Thread starter HAL2100again
  • Start date Start date
H

HAL2100again

Guest
I have some code saved as a module which I will call to modify different forms.
I would like to set the form name in code associated with the form from which it is called.
How do I do this?

I've been trying to use the Set Statement to set the variable 'blobby' on the form on which I want the module to act.

Dim blobby As Form
Set blobby = Forms![FormName]
Call ModuleName

But this doesn't get passed to the module.
 
The module is only the wrapper in which subs and functions are situated.
If you have a PUBLIC sub or function in a PUBLIC module (one that appears in the Module window, not a form or report Module) then you can call it from anywhere in the application.

Independantly from this:
You can not use []-brackets in you code, but ()-brackets:

Set blobby = Forms!(FormName)
Call SubName(blobby) OR
somevalue=subName(blobby)
 

Users who are viewing this thread

Back
Top Bottom