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

Passing a report name as an argument to a function

Status
Not open for further replies.

Southerndiva

IS-IT--Management
May 15, 2002
31
TT
I have written a generic function which is being called from many reports. It concatenates the values of certain fields depending on the value of check boxes. i have created an unbound textbox on the report and its control source = fldvalu()

the first line of the function goes like this

function fldvalu() as string
if reports!rptname!chkfld = -1 then
fldvalu = "some thing;"
endif
if reports!rptname!chkfld2 = -1 then
fldvalu = fldvalu &"something2;"
endif

you get my drift. note that i have hard coded the report name. i need not to hard code the report name, so that the function can be called from any report.

should be simple. but where and how do i do it?

thanks in advance.
 
function fldvalu(rptname as string) as string
if reports(rptname)!chkfld= -1 then
fldvalu = "some thing;"
endif
if reports(rptname)!chkfld2 = -1 then
fldvalu = fldvalu &"something2;"
end if

call function
fldvalu("reportname") is how you would pass it in a function

but I belive all you need is me!chkfld

function fldvalu() as string
if me!chkfld = -1 then
fldvalu = "some thing;"
endif
if me!chkfld2 = -1 then
fldvalu = fldvalu &"something2;"
end if

To be honest not real sure what you are trying to do but hopefully my post gives you an idea
good luck


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top