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

error calling a function/sub

Status
Not open for further replies.

tziviak2

MIS
Jul 20, 2004
53
0
0
US
I have a button that calls a report-that button has 2 subs.
I want on the onclose of the report-to call the the secondsub-"printReport" but when I call that function I'm getting
"compile error sub or function not defined"
I'm sure that if I put that sub in a regular module it will be no problem-but how do I keep in the button code.
the sub is public-not private
I'm using access 97
thank you
 
Hi - love to help. Please post your code.

Tom

Born once die twice; born twice die once.
 
Weeeeell - not quite what I had in mind, but let's see if this makes sense:

If printAttendanceRecord does not return a value, it should not be a function but a sub. I mention this because
I want on the onclose of the report-to call the the secondsub-"printReport" but when I call that [!]function[/!]
which leads me to believe there is some confusion of terms. The following is straight from Access help:
You are not required to use the Call keyword when calling a procedure. However, if you use the Call keyword to call a procedure that requires arguments, argumentlist must be enclosed in parentheses. If you omit the Call keyword, you also must omit the parentheses around argumentlist. If you use either Call syntax to call any intrinsic or user-defined function, the function's return value is discarded.

Not sure if this is enough to get you on target, but I was asking for a bit more than the offending line...[smile]

If you are not able to correct the problem from the bit of advice given, please post the rest of your code.

Tom



Born once die twice; born twice die once.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top