Set Visible On Button Click

D

dsc2bjn

I have a very demanding client that I am trying to satisfy.

They would like to make a control in a report visible only when the user
uses a "Print" button and not when they use a "Preview" button.

Setting the control invisible is a no brainer, but how can I make the
control visible when the user clicks on the "Print" button.

Any suggestions would be greatly appreciated (changing clients isn't an
option at this time).
 
C

Carl Rapson

dsc2bjn said:
I have a very demanding client that I am trying to satisfy.

They would like to make a control in a report visible only when the user
uses a "Print" button and not when they use a "Preview" button.

Setting the control invisible is a no brainer, but how can I make the
control visible when the user clicks on the "Print" button.

Any suggestions would be greatly appreciated (changing clients isn't an
option at this time).

From what I can tell, the report's Activate event only fires when the report
is previewed, not printed. So maybe you could make the control invisible by
default and in the Activate event you could make the control visible.

Carl Rapson
 
F

fredg

I have a very demanding client that I am trying to satisfy.

They would like to make a control in a report visible only when the user
uses a "Print" button and not when they use a "Preview" button.

Setting the control invisible is a no brainer, but how can I make the
control visible when the user clicks on the "Print" button.

Any suggestions would be greatly appreciated (changing clients isn't an
option at this time).

The actual starting value of intPreview depends upon if you have a
control in the report to compute [Pages], i.e. ="Page " & [Page] & "
of " & [Pages]

Option Compare Database
Option Explicit
Dim intPreview As Integer

Private Sub Report_Activate()
intPreview = -1 ' Pages Not used
' intPreview = -2 ' Pages used

End Sub
===============

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)

' If intPreview >= 1 Then ' Pages used
If intPreview > -1 Then ' Pages is not used

Me![Data].Visible = True
Else
Me![Data].Visible = False
End If
intPreview = intPreview + 1
End Sub
 
D

dsc2bjn

I do have the Page of Pages control on the report.

I used your code, but it didn't work. I set the [Reporting Period] control
to invisible and it stays invisible both in preview and when printing.

I should point out that the "Print" button is running a macro that sends the
report via email as a snapshot file. The user isn't actually printing a hard
copy report.



fredg said:
I have a very demanding client that I am trying to satisfy.

They would like to make a control in a report visible only when the user
uses a "Print" button and not when they use a "Preview" button.

Setting the control invisible is a no brainer, but how can I make the
control visible when the user clicks on the "Print" button.

Any suggestions would be greatly appreciated (changing clients isn't an
option at this time).

The actual starting value of intPreview depends upon if you have a
control in the report to compute [Pages], i.e. ="Page " & [Page] & "
of " & [Pages]

Option Compare Database
Option Explicit
Dim intPreview As Integer

Private Sub Report_Activate()
intPreview = -1 ' Pages Not used
' intPreview = -2 ' Pages used

End Sub
===============

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)

' If intPreview >= 1 Then ' Pages used
If intPreview > -1 Then ' Pages is not used

Me![Data].Visible = True
Else
Me![Data].Visible = False
End If
intPreview = intPreview + 1
End Sub
 
F

fredg

I do have the Page of Pages control on the report.

I used your code, but it didn't work. I set the [Reporting Period] control
to invisible and it stays invisible both in preview and when printing.

I should point out that the "Print" button is running a macro that sends the
report via email as a snapshot file. The user isn't actually printing a hard
copy report.

fredg said:
I have a very demanding client that I am trying to satisfy.

They would like to make a control in a report visible only when the user
uses a "Print" button and not when they use a "Preview" button.

Setting the control invisible is a no brainer, but how can I make the
control visible when the user clicks on the "Print" button.

Any suggestions would be greatly appreciated (changing clients isn't an
option at this time).

The actual starting value of intPreview depends upon if you have a
control in the report to compute [Pages], i.e. ="Page " & [Page] & "
of " & [Pages]

Option Compare Database
Option Explicit
Dim intPreview As Integer

Private Sub Report_Activate()
intPreview = -1 ' Pages Not used
' intPreview = -2 ' Pages used

End Sub
===============

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)

' If intPreview >= 1 Then ' Pages used
If intPreview > -1 Then ' Pages is not used

Me![Data].Visible = True
Else
Me![Data].Visible = False
End If
intPreview = intPreview + 1
End Sub

Then it's not actually BEING printed is it?
 
D

dsc2bjn

No. The idea is to reduce paper copies, so no actual printing occurs.

The user can print the report through the "Preview" button, but I do not
want it to show the [Reporting Period] value.

The data is collected put into the report format and send as a snapshot view
Via email.

When they "Print" (now is renamed as "Submit"), I prompt them to enter value
for the [Reporting Period]. I want the control to be visible when they send
the report Via email.

fredg said:
I do have the Page of Pages control on the report.

I used your code, but it didn't work. I set the [Reporting Period] control
to invisible and it stays invisible both in preview and when printing.

I should point out that the "Print" button is running a macro that sends the
report via email as a snapshot file. The user isn't actually printing a hard
copy report.

fredg said:
On Wed, 18 Jul 2007 14:02:01 -0700, dsc2bjn wrote:

I have a very demanding client that I am trying to satisfy.

They would like to make a control in a report visible only when the user
uses a "Print" button and not when they use a "Preview" button.

Setting the control invisible is a no brainer, but how can I make the
control visible when the user clicks on the "Print" button.

Any suggestions would be greatly appreciated (changing clients isn't an
option at this time).

The actual starting value of intPreview depends upon if you have a
control in the report to compute [Pages], i.e. ="Page " & [Page] & "
of " & [Pages]

Option Compare Database
Option Explicit
Dim intPreview As Integer

Private Sub Report_Activate()
intPreview = -1 ' Pages Not used
' intPreview = -2 ' Pages used

End Sub
===============

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)

' If intPreview >= 1 Then ' Pages used
If intPreview > -1 Then ' Pages is not used

Me![Data].Visible = True
Else
Me![Data].Visible = False
End If
intPreview = intPreview + 1
End Sub

Then it's not actually BEING printed is it?
 

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