On activate report only prints some data

  • Thread starter Thread starter dbl
  • Start date Start date
D

dbl

Hi I have a report with the following code, all works fine when the report
is previewed and then printed but if the report is sent direct to the
printer the following data is not displayed, has anyone any idea's why, what
am I doing wrong? (Its seems to me it prints before it has had time to
update the information if that makes since).

Thanks Bob

Me.Text375 = "PLEASE GIVE FULL DETAILS"
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
Me.Label222.Visible = False
Me.Label223.Visible = False
Also the last part of the code to do with phone numbers is not displayed

The report works on Activate

If Me.DrivingOffence = "YES" Then
Me.Label222.Visible = False
Me.Text375 = "PLEASE GIVE FULL DETAILS"
GoTo OverMe
Else
If Me.DrivingOffence = "NO" Or IsNull(Me.DrivingOffence) Then
Me.Text375 = "If Yes please give full details"

OverMe:
If Me.InvolvedAccidents = "YES" Then
Me.Label223.Visible = False
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
GoTo Over
Else
If Me.InvolvedAccidents = "NO" Or IsNull(Me.InvolvedAccidents) Then
Me.Text377 = "If Yes please give full details including the dates"


Over:

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone
End If
End If
End If
End If
End If
End If
 
I think you could do most of this without any code. For instance change
Label222 to a text box and set its control source to:
=IIf([DrivingOffence = "Yes", "", "Some Other Caption")
Text377 might be like:
=IIf([DrivingOffence = "Yes", "PLEASE GIVE FULL DETAILS", "Some Other
Caption")

However, your code should not be in the On Activate event. Place the code in
the On Format event of the section of the report containing the controls.
 
Duane that works fine but how do I get this part of the code to work in a
text box without using code. Also I cannot find a on format event on the
report or on the form with the controls, the report is generated from the
info on the form.

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone


Duane Hookom said:
I think you could do most of this without any code. For instance change
Label222 to a text box and set its control source to:
=IIf([DrivingOffence = "Yes", "", "Some Other Caption")
Text377 might be like:
=IIf([DrivingOffence = "Yes", "PLEASE GIVE FULL DETAILS", "Some Other
Caption")

However, your code should not be in the On Activate event. Place the code
in the On Format event of the section of the report containing the
controls.

--
Duane Hookom
MS Access MVP


dbl said:
Hi I have a report with the following code, all works fine when the
report is previewed and then printed but if the report is sent direct to
the printer the following data is not displayed, has anyone any idea's
why, what am I doing wrong? (Its seems to me it prints before it has had
time to update the information if that makes since).

Thanks Bob

Me.Text375 = "PLEASE GIVE FULL DETAILS"
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
Me.Label222.Visible = False
Me.Label223.Visible = False
Also the last part of the code to do with phone numbers is not displayed

The report works on Activate

If Me.DrivingOffence = "YES" Then
Me.Label222.Visible = False
Me.Text375 = "PLEASE GIVE FULL DETAILS"
GoTo OverMe
Else
If Me.DrivingOffence = "NO" Or IsNull(Me.DrivingOffence) Then
Me.Text375 = "If Yes please give full details"

OverMe:
If Me.InvolvedAccidents = "YES" Then
Me.Label223.Visible = False
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
GoTo Over
Else
If Me.InvolvedAccidents = "NO" Or IsNull(Me.InvolvedAccidents) Then
Me.Text377 = "If Yes please give full details including the dates"


Over:

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone
End If
End If
End If
End If
End If
End If
 
Set the control source to:
=Nz([WorkPhone], Nz([MobilePhone],[HomePhone])

Each section of the report has an On Format Property.
--
Duane Hookom
MS Access MVP

dbl said:
Duane that works fine but how do I get this part of the code to work in a
text box without using code. Also I cannot find a on format event on the
report or on the form with the controls, the report is generated from the
info on the form.

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone


Duane Hookom said:
I think you could do most of this without any code. For instance change
Label222 to a text box and set its control source to:
=IIf([DrivingOffence = "Yes", "", "Some Other Caption")
Text377 might be like:
=IIf([DrivingOffence = "Yes", "PLEASE GIVE FULL DETAILS", "Some Other
Caption")

However, your code should not be in the On Activate event. Place the code
in the On Format event of the section of the report containing the
controls.

--
Duane Hookom
MS Access MVP


dbl said:
Hi I have a report with the following code, all works fine when the
report is previewed and then printed but if the report is sent direct to
the printer the following data is not displayed, has anyone any idea's
why, what am I doing wrong? (Its seems to me it prints before it has had
time to update the information if that makes since).

Thanks Bob

Me.Text375 = "PLEASE GIVE FULL DETAILS"
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
Me.Label222.Visible = False
Me.Label223.Visible = False
Also the last part of the code to do with phone numbers is not displayed

The report works on Activate

If Me.DrivingOffence = "YES" Then
Me.Label222.Visible = False
Me.Text375 = "PLEASE GIVE FULL DETAILS"
GoTo OverMe
Else
If Me.DrivingOffence = "NO" Or IsNull(Me.DrivingOffence) Then
Me.Text375 = "If Yes please give full details"

OverMe:
If Me.InvolvedAccidents = "YES" Then
Me.Label223.Visible = False
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
GoTo Over
Else
If Me.InvolvedAccidents = "NO" Or IsNull(Me.InvolvedAccidents) Then
Me.Text377 = "If Yes please give full details including the dates"


Over:

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone
End If
End If
End If
End If
End If
End If
 
Duane that comes up with the following error Expression contains invalid
syntax entered operand without operator. I thought it was a missing bracket
but it doesn't matter where you put the brackets I still get the same error
code.

Yes I see what you mean regarding the on format property, I wasn't looking
in the right place.

Thanks for you help.

Bob


Duane Hookom said:
Set the control source to:
=Nz([WorkPhone], Nz([MobilePhone],[HomePhone])

Each section of the report has an On Format Property.
--
Duane Hookom
MS Access MVP

dbl said:
Duane that works fine but how do I get this part of the code to work in a
text box without using code. Also I cannot find a on format event on the
report or on the form with the controls, the report is generated from the
info on the form.

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone


Duane Hookom said:
I think you could do most of this without any code. For instance change
Label222 to a text box and set its control source to:
=IIf([DrivingOffence = "Yes", "", "Some Other Caption")
Text377 might be like:
=IIf([DrivingOffence = "Yes", "PLEASE GIVE FULL DETAILS", "Some Other
Caption")

However, your code should not be in the On Activate event. Place the
code in the On Format event of the section of the report containing the
controls.

--
Duane Hookom
MS Access MVP


Hi I have a report with the following code, all works fine when the
report is previewed and then printed but if the report is sent direct
to the printer the following data is not displayed, has anyone any
idea's why, what am I doing wrong? (Its seems to me it prints before it
has had time to update the information if that makes since).

Thanks Bob

Me.Text375 = "PLEASE GIVE FULL DETAILS"
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
Me.Label222.Visible = False
Me.Label223.Visible = False
Also the last part of the code to do with phone numbers is not
displayed

The report works on Activate

If Me.DrivingOffence = "YES" Then
Me.Label222.Visible = False
Me.Text375 = "PLEASE GIVE FULL DETAILS"
GoTo OverMe
Else
If Me.DrivingOffence = "NO" Or IsNull(Me.DrivingOffence) Then
Me.Text375 = "If Yes please give full details"

OverMe:
If Me.InvolvedAccidents = "YES" Then
Me.Label223.Visible = False
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
GoTo Over
Else
If Me.InvolvedAccidents = "NO" Or IsNull(Me.InvolvedAccidents) Then
Me.Text377 = "If Yes please give full details including the dates"


Over:

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone
End If
End If
End If
End If
End If
End If
 
I missed a right paren:
=Nz([WorkPhone], Nz([MobilePhone],[HomePhone]))
--
Duane Hookom
MS Access MVP


dbl said:
Duane that comes up with the following error Expression contains invalid
syntax entered operand without operator. I thought it was a missing
bracket but it doesn't matter where you put the brackets I still get the
same error code.

Yes I see what you mean regarding the on format property, I wasn't looking
in the right place.

Thanks for you help.

Bob


Duane Hookom said:
Set the control source to:
=Nz([WorkPhone], Nz([MobilePhone],[HomePhone])

Each section of the report has an On Format Property.
--
Duane Hookom
MS Access MVP

dbl said:
Duane that works fine but how do I get this part of the code to work in
a text box without using code. Also I cannot find a on format event on
the report or on the form with the controls, the report is generated
from the info on the form.

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone


"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
I think you could do most of this without any code. For instance change
Label222 to a text box and set its control source to:
=IIf([DrivingOffence = "Yes", "", "Some Other Caption")
Text377 might be like:
=IIf([DrivingOffence = "Yes", "PLEASE GIVE FULL DETAILS", "Some Other
Caption")

However, your code should not be in the On Activate event. Place the
code in the On Format event of the section of the report containing the
controls.

--
Duane Hookom
MS Access MVP


Hi I have a report with the following code, all works fine when the
report is previewed and then printed but if the report is sent direct
to the printer the following data is not displayed, has anyone any
idea's why, what am I doing wrong? (Its seems to me it prints before
it has had time to update the information if that makes since).

Thanks Bob

Me.Text375 = "PLEASE GIVE FULL DETAILS"
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
Me.Label222.Visible = False
Me.Label223.Visible = False
Also the last part of the code to do with phone numbers is not
displayed

The report works on Activate

If Me.DrivingOffence = "YES" Then
Me.Label222.Visible = False
Me.Text375 = "PLEASE GIVE FULL DETAILS"
GoTo OverMe
Else
If Me.DrivingOffence = "NO" Or IsNull(Me.DrivingOffence) Then
Me.Text375 = "If Yes please give full details"

OverMe:
If Me.InvolvedAccidents = "YES" Then
Me.Label223.Visible = False
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
GoTo Over
Else
If Me.InvolvedAccidents = "NO" Or IsNull(Me.InvolvedAccidents) Then
Me.Text377 = "If Yes please give full details including the dates"


Over:

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone
End If
End If
End If
End If
End If
End If
 
That works fine.

Thanks for all your help it is very much appreciated.

Bob
Duane Hookom said:
I missed a right paren:
=Nz([WorkPhone], Nz([MobilePhone],[HomePhone]))
--
Duane Hookom
MS Access MVP


dbl said:
Duane that comes up with the following error Expression contains invalid
syntax entered operand without operator. I thought it was a missing
bracket but it doesn't matter where you put the brackets I still get the
same error code.

Yes I see what you mean regarding the on format property, I wasn't
looking in the right place.

Thanks for you help.

Bob


Duane Hookom said:
Set the control source to:
=Nz([WorkPhone], Nz([MobilePhone],[HomePhone])

Each section of the report has an On Format Property.
--
Duane Hookom
MS Access MVP

Duane that works fine but how do I get this part of the code to work in
a text box without using code. Also I cannot find a on format event on
the report or on the form with the controls, the report is generated
from the info on the form.

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone


"Duane Hookom" <DuaneAtNoSpanHookomDotNet> wrote in message
I think you could do most of this without any code. For instance change
Label222 to a text box and set its control source to:
=IIf([DrivingOffence = "Yes", "", "Some Other Caption")
Text377 might be like:
=IIf([DrivingOffence = "Yes", "PLEASE GIVE FULL DETAILS", "Some
Other Caption")

However, your code should not be in the On Activate event. Place the
code in the On Format event of the section of the report containing
the controls.

--
Duane Hookom
MS Access MVP


Hi I have a report with the following code, all works fine when the
report is previewed and then printed but if the report is sent direct
to the printer the following data is not displayed, has anyone any
idea's why, what am I doing wrong? (Its seems to me it prints before
it has had time to update the information if that makes since).

Thanks Bob

Me.Text375 = "PLEASE GIVE FULL DETAILS"
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
Me.Label222.Visible = False
Me.Label223.Visible = False
Also the last part of the code to do with phone numbers is not
displayed

The report works on Activate

If Me.DrivingOffence = "YES" Then
Me.Label222.Visible = False
Me.Text375 = "PLEASE GIVE FULL DETAILS"
GoTo OverMe
Else
If Me.DrivingOffence = "NO" Or IsNull(Me.DrivingOffence) Then
Me.Text375 = "If Yes please give full details"

OverMe:
If Me.InvolvedAccidents = "YES" Then
Me.Label223.Visible = False
Me.Text377 = "PLEASE GIVE FULL INCIDENT DETAILS"
GoTo Over
Else
If Me.InvolvedAccidents = "NO" Or IsNull(Me.InvolvedAccidents) Then
Me.Text377 = "If Yes please give full details including the dates"


Over:

Me.Text367 = Me.WorkPhone
If IsNull(Me.WorkPhone) Then
Me.Text367 = Me.MobilePhone
If IsNull(Me.WorkPhone) And IsNull(Me.MobilePhone) Then
Me.Text367 = Me.HomePhone
End If
End If
End If
End If
End If
End If
 
Back
Top