Working with Reports trying to use the visible propery of a txt co

G

Guest

I am trying to print a report "WORKTICKET" that shows or hides a graphic
depending on the value in the "ITEM" field.

I get the following error:

Procedure declaration does not match description of event or procedure
having same name

The code is as follows:

Private Sub Report_Activate(Cancel As Integer)
If Reports!WorkTicket!Item.Value = "pillow" Then
Reports!WorkTicket!pillowFig.Visible = True
Else: Reports!WorkTicket!pillowFig.Visible = False
End If
End Sub

Any suggestions are greatly appreciated!
 
S

Steve Schapel

Lele,

I think the Activate event of the report is probably not the appropriate
place for this. I would suggest the Format event of the section where
the graphic control is located.

By the way, you could simplify the code like this...
Me.pillowFig.Visible = (Me.Item = "pillow")
 
G

Guest

Hello,

Thanks, I have already made progress with your suggestion since I am no
longer getting the error message; however, when I type in the code the figure
is always hidden, so somehow it must not be identifing the value correctly.
Also,I decided to simply my code as you suggested. I have the auto syntax
check on and when I type ME. PILLOWFIG. the visible property is not in my
list of choices after I type the second dot.

Thanks so much for your suggestions.
 
S

Steve Schapel

Lele,

No, VBA Intellisense does not show certain items, including the Visible
property of controls on reports. Just go ahead and use it anyway. Mind
you, I see you have a space between the Me. and the P... This is not
correct.

So, the value of the 'Item' field is not being identified as "pillow".
The first thing that this makes me suspect is that it is a Lookup
field... could that be correct? So "pillow" is the second column in a
lookup list, but the "real" (hidden) value of the field is an ID number
or some such? If this does not apply, let me know and we'll have to try
something else. Just by way of identifying where the problem lies, try
this for an experiment...
Me.pillowFig.Visible = (Me.Item <> "X")
This "should" result in the figure being shown for all records.
Just to check... You are using the Format event of the report *Section*
where the figure is located, right? And the Item control is also in
this same section?
 
S

Steve Schapel

Lele,

To me, this points to the entry in the Item control does not match what
you put in your code. Can you please re-check that if your code says
"pillow" then this is exactly the data that is entered in the Item field.

Another possible thing to check is that if you copy/pasted the code from
your newsreader, depending on your settings it may have changed the ""s
to “”s which might mess things up.
 
G

Guest

Hi again Steve,

I retyped the code, and found a typo. It is working great now. Thanks so
much.
 
S

Steve Schapel

Excellent, Lele. Very happy to hear it. Best wishes with the rest of
your project.
 

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