By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,209 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,209 IT Pros & Developers. It's quick & easy.

How to pass multiple arguments when calling Function?

P: n/a
I'd like to use a bit of code in the OnOpen event of a report:

=rptOpen(Me.ReportName), (Me.Tag) --this doesn't work

This does work:

Private Sub Report_Open(Cancel As Integer)
modHandler.rptOpen (Me.Report.Name), (Me.Tag)
End Sub

What I'm trying to do is avoid having the code in the report's module and
simply have the Function call in the OnOpen field of the report's property
sheet. But I can't seem to get the syntax right to pass both arguments to
the Function. I get an error when trying to type it in the property sheet -
"invalid syntax" or "wrong number of arguments".

If I want to pass only one argument, this works okay:

=rptOpen(Me.ReportName)

How to pass two arguments?

Thanks in advance!
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Write a public function that will accept both args as parameters, that
call it in the event?

Pavel

deko wrote:

I'd like to use a bit of code in the OnOpen event of a report:

=rptOpen(Me.ReportName), (Me.Tag) --this doesn't work

This does work:

Private Sub Report_Open(Cancel As Integer)
modHandler.rptOpen (Me.Report.Name), (Me.Tag)
End Sub

What I'm trying to do is avoid having the code in the report's module and
simply have the Function call in the OnOpen field of the report's property
sheet. But I can't seem to get the syntax right to pass both arguments to
the Function. I get an error when trying to type it in the property sheet -
"invalid syntax" or "wrong number of arguments".

If I want to pass only one argument, this works okay:

=rptOpen(Me.ReportName)

How to pass two arguments?

Thanks in advance!

Nov 12 '05 #2

P: n/a
in the report_open event the ME object can be used to reference objects in
the report w/o passing another parameter, ex:
Private Sub Report_Open(Cancel As Integer)
on error etc . . .

dim MyTag as string

Mytag = me.tag

etc . . .

End Sub
if the info exists somewhere else then either create a reference to that
object, or create a function to pass the value to the report, or use a
global variable, or reference a field on an open form, etc....

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"Pavel Romashkin" <pa*************@hotmail.com> wrote in message
news:3F***************@hotmail.com...
Write a public function that will accept both args as parameters, that
call it in the event?

Pavel

deko wrote:

I'd like to use a bit of code in the OnOpen event of a report:

=rptOpen(Me.ReportName), (Me.Tag) --this doesn't work

This does work:

Private Sub Report_Open(Cancel As Integer)
modHandler.rptOpen (Me.Report.Name), (Me.Tag)
End Sub

What I'm trying to do is avoid having the code in the report's module and simply have the Function call in the OnOpen field of the report's property sheet. But I can't seem to get the syntax right to pass both arguments to the Function. I get an error when trying to type it in the property sheet - "invalid syntax" or "wrong number of arguments".

If I want to pass only one argument, this works okay:

=rptOpen(Me.ReportName)

How to pass two arguments?

Thanks in advance!

Nov 12 '05 #3

P: n/a
Here's the Function I want to call - stored in a standard module named
"modHandler":

Public Function rptOpen(fn, tbl)
code...
End Function

All I want to do is pass two arguments (the "fn" and "tbl" variables) to
this function.

If I put the below code as an *Event Procedure* in the OnOpen event of the
Report, it works:

Private Sub Report_Open(Cancel As Integer)
modHandler.rptOpen (Me.Report.Name), (Me.Tag)
End Sub

However, I want to call the function *without* the above code in the
report's module. Rahter than putting code in the report's module, I want to
put a call to the Function in the Report's property sheet:

=rptOpen("rptName", "tblData")

But I can't seem to get this to pass both arguments. Should it be:

=rptOpen("rptName"), ("tblData") ??

or some other syntax?
"xzzy" <mr********@comcast.net> wrote in message
news:DxHEb.431108$275.1303132@attbi_s53...
in the report_open event the ME object can be used to reference objects in
the report w/o passing another parameter, ex:
Private Sub Report_Open(Cancel As Integer)
on error etc . . .

dim MyTag as string

Mytag = me.tag

etc . . .

End Sub
if the info exists somewhere else then either create a reference to that
object, or create a function to pass the value to the report, or use a
global variable, or reference a field on an open form, etc....

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"Pavel Romashkin" <pa*************@hotmail.com> wrote in message
news:3F***************@hotmail.com...
Write a public function that will accept both args as parameters, that
call it in the event?

Pavel

deko wrote:

I'd like to use a bit of code in the OnOpen event of a report:

=rptOpen(Me.ReportName), (Me.Tag) --this doesn't work

This does work:

Private Sub Report_Open(Cancel As Integer)
modHandler.rptOpen (Me.Report.Name), (Me.Tag)
End Sub

What I'm trying to do is avoid having the code in the report's module and simply have the Function call in the OnOpen field of the report's property sheet. But I can't seem to get the syntax right to pass both
arguments
to the Function. I get an error when trying to type it in the property sheet - "invalid syntax" or "wrong number of arguments".

If I want to pass only one argument, this works okay:

=rptOpen(Me.ReportName)

How to pass two arguments?

Thanks in advance!


Nov 12 '05 #4

P: n/a
"deko" <dj****@hotmail.com> wrote in message
news:7t**************@newssvr25.news.prodigy.com.. .
Here's the Function I want to call - stored in a standard module named
"modHandler":

Public Function rptOpen(fn, tbl)
code...
End Function

All I want to do is pass two arguments (the "fn" and "tbl" variables) to
this function.

If I put the below code as an *Event Procedure* in the OnOpen event of the
Report, it works:

Private Sub Report_Open(Cancel As Integer)
modHandler.rptOpen (Me.Report.Name), (Me.Tag)
End Sub

However, I want to call the function *without* the above code in the
report's module. Rahter than putting code in the report's module, I want to
put a call to the Function in the Report's property sheet:

=rptOpen("rptName", "tblData")

But I can't seem to get this to pass both arguments. Should it be:

=rptOpen("rptName"), ("tblData") ??

If you are passing actual string values then this is correct...
=rptOpen("rptName", "tblData")

If those are string *variables* then ...
=rptOpen(rptName, tblData)
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


Nov 12 '05 #5

P: n/a
thanks for the reply -

yes, those are supposed to be string values.

I've discovered that

=rptOpen(Me.Report.Name, Me.Tag)

will not work in the Property Sheet.

But when working in the Report's Module, this does the trick:

modHandler.rptOpen (Me.Report.Name), (Me.Tag)

I'll see what I can do in the Property Sheet now that I know the correct
syntax...

Thanks for the help!

If you are passing actual string values then this is correct...
=rptOpen("rptName", "tblData")

If those are string *variables* then ...
=rptOpen(rptName, tblData)

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.