OK, so I create a new module called "InitSPerson" and declare strSPerson
global (Global strSPerson as String). So then I can 'call' this proc by
asigning it to the 'on open' event of the form, right? At least that's where
my thinking leads me. So I don't see a way to 'call' the InitSPerson module.
I feel like such a newbie.
Steve
> Ho Steve
> Declare strSPerson as Global in a Module, and than you
[quoted text clipped - 48 lines]
>>
>>.
Ofer - 12 Apr 2005 16:45 GMT
1. You declared strSPerson as Global
2. After you update the name of the saleperson assign that
name to strSPerson that you declared
3. On the print property of the report assign tha value of
strSPerson to the field on the report.
or create a function that return the value of strSPerson
and on controlsource of the field on the report write =
and the name of the function you created
>-----Original Message-----
>OK, so I create a new module called "InitSPerson" and declare strSPerson
[quoted text clipped - 59 lines]
>
>.
GSteven - 12 Apr 2005 17:42 GMT
Thank you very much for your replies.
OK, I place a textbox on my report and set control source to "strSPerson" or
"=strSPerson" and when I run report I get a dialog asking for strSPerson.
Decide on second suggestion. Go to module tab of database and click 'new'.
Name module 'GetSP' and contains the lines 'compare database'. 'Public
function GetSP(salper as string)', 'salper = InitSPerson.strSPerson' & 'End
Function'.
Now I cannot see the function in the builder dialog box therefore cannot
choose the function.
???
> 1. You declared strSPerson as Global
> 2. After you update the name of the saleperson assign that
[quoted text clipped - 77 lines]
>>
>>.
Ofer - 12 Apr 2005 18:14 GMT
You mixed it up
lets try one way:
1. declared strSPerson as Global variable (You did that)
2. After you update the name of the saleperson assign that
name to strSPerson Variable that you declared (Check with
the Debuger that the variable has the value)
3. create a function that return the value of strSPerson
Function GlobstrSPerson() as string
'***************************************************
' This function will return the Name of the sales man
'***************************************************
GlobstrSPerson = strSPerson
end Function
4. On control source of the field on the report write:
"=GlobstrSPerson()"
>-----Original Message-----
>Thank you very much for your replies.
[quoted text clipped - 94 lines]
>
>.
GSteven - 12 Apr 2005 18:39 GMT
see below
1. declared strSPerson as Global variable (You did that) (Yes,
successfully)
2. After you update the name of the saleperson assign that name to
strSPerson Variable that you declared (Check with the Debuger that the
variable has the value) (debugger shows value was assigned to strSPerson as
string type under InitSPerson context)
3. create a function that return the value of strSPerson
Function GlobstrSPerson() as string
'***************************************************
' This function will return the Name of the sales man
'***************************************************
GlobstrSPerson = strSPerson
end Function
(Done exactly as described)
4. On control source of the field on the report write: "=GlobstrSPerson()"
(done, when I run report I get dialog asking for a value for GlobstrSPerson
and I can either leave it blank or enter some string. In either case when
the report comes up the field has #Name? in it.)
Furthermore when I'm in debug immediate window and enter ? GlobstrSPerson()
I get a compile error "Expected variable or procedure, not module". Does
this shed any more light on it?
thanks again for your patience
Steve
>>-----Original Message-----
>>Thank you very much for your replies.
[quoted text clipped - 109 lines]
>>
>>.