Function in Control Source with Param

S

Stu

I have defined a function: Function iFileCount(sID as string) as integer

If I put the following into the control source of an unbound report field
the function works fine: =iFileCount("9999")

Question: Is there a way to make the sID parameter a variable that is
another field on the current record of the report? Such as
=iFileCount(me.IDField). Or some other way maybe bu using a query and/or
sub-report?

Tnx
 
S

Stu

Duh, thanks much. That was it!


Ken Snell said:
=iFileCount([IDField])

Put the name of the field in [ ] characters.
--

Ken Snell
http://www.accessmvp.com/KDSnell/




Stu said:
I have defined a function: Function iFileCount(sID as string) as integer

If I put the following into the control source of an unbound report field
the function works fine: =iFileCount("9999")

Question: Is there a way to make the sID parameter a variable that is
another field on the current record of the report? Such as
=iFileCount(me.IDField). Or some other way maybe bu using a query and/or
sub-report?

Tnx


.
 
M

Marshall Barton

Stu said:
Duh, thanks much. That was it!


Ken Snell said:
=iFileCount([IDField])

Put the name of the field in [ ] characters.

Actually, the [ ] don't matter in this case. The brackets
are only needed when a name contains non alphanumeric
characters (and when used in a Conditional Formatting
expression.)

It was the Me that was causing the problem. Me is only
valid in a VBA class module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top