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!

Conditionally printing subreports 2

Status
Not open for further replies.

LD1010

Technical User
Dec 6, 2001
78
US
I was searching for advice on how to conditionally print subreports and came upon thread 703-1287109 where dhookom suggested the following code to be placed in the On Format event of the section containing the subreports. Me.subreportName.Visible = (Me.SomeTextBox = True) I rewrote this as follows: Me.srptFileFolder.Visible = (Me.ProgramClaimTypeID = 2) When I ran this I got the following error. “Can’t find the macro ‘Me.’ The macro (or its macro group) doesn’t exist, or the macro is new but hasn’t been saved. Note that when you enter the macrogroupname.macroname syntax in an argument, you must specify the name the macro’s macro group was last saved under.”
I don’t understand the message, nor what I need to do correct the problem. I’m very new to writing code, any help would be appreciated.
 
'Me' refers to the current report or current form, it is not suitable for a macro. DHookom means something a bit like this:

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.srptFileFolder.Visible = (Me.ProgramClaimTypeID = 2)  
End Sub

Is this what you have?
 
I expect LD1010 entered the code into the property rather than opening the code module for the event.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Happy New Year to you Remou and dhookom and thanks for the response. It works great now. Dhookom was correct I did enter the code into the property. You guys are great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top