Type mismatch in function called in report OnOpen event

  • Thread starter Thread starter Richard S.
  • Start date Start date
R

Richard S.

I have a public procedure from which the following is extracted:

Public Sub SetFontPrint(RptName As Report)
With RptName
.Text1.FontName = LabelFontName & ""
End With

The following call is in the report_open event:

SetFontPrint (Me)

I get a Type Mismatch error when invoking the procedure in the report. I'm
attempting at run-time to set font properties that are selected by the user
and stored in public variables (e.g., LabelFontName).

I will appreciate any help in resolving this problem.

Richard
 
For the sake of completeness, the alternative

SetFontPrint Me

should also work.

The problem is that without the Call keyword, putting parentheses around a
variable passes that variable ByVal, instead of the normal ByRef.
 
Thank you for the help.

Douglas J. Steele said:
For the sake of completeness, the alternative

SetFontPrint Me

should also work.

The problem is that without the Call keyword, putting parentheses around a
variable passes that variable ByVal, instead of the normal ByRef.
 

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

Back
Top