CheckBox to open Portrait or Landscape report

  • Thread starter Thread starter Bob V
  • Start date Start date
B

Bob V

Private Sub cbCategory_Click()
DoCmd.OpenReport "rptPrintMainCategoryRemark", acViewPreview
End Sub

This is what I have at the moment but would like to change it too, My
Checkbox Yes/No [ckbPortrait] on record source of My form
:
Private Sub cbCategory_Click()
If ckbPortrait =True, DoCmd.OpenReport "rptPrintMainCategoryRemarkPort",
acViewPreview
or
If ckbPortrait = False, DoCmd.OpenReport "rptPrintMainCategoryRemark",
acViewPreview
End Sub

Thanks for any help.....Bob
 
Private Sub cbCategory_Click()
If ckbPortrait = True Then
DoCmd.OpenReport "rptPrintMainCategoryRemarkPort", acViewPreview
Else
DoCmd.OpenReport "rptPrintMainCategoryRemark",
End If
End Sub

Since ckbPortrait is a checkbox, it can only have a value of True (Yes) or
False (No), so you can simplify the If statement to just:
If ckbPortrait Then
The longer version may make it simpler to understand when you re-visit it
later ;-)

HTH,

Rob
 
Hi Rob, Thanks but I am getting a red font error:
Private Sub cbCategory_Click()
If ckbPortrait = True Then
DoCmd.OpenReport "rptPrintMainCategoryRemarkPort", acViewPreview
Else
DoCmd.OpenReport "rptPrintMainCategoryRemark",'*****RED FONT***
End If
End Sub

Rob Parker said:
Private Sub cbCategory_Click()
If ckbPortrait = True Then
DoCmd.OpenReport "rptPrintMainCategoryRemarkPort", acViewPreview
Else
DoCmd.OpenReport "rptPrintMainCategoryRemark",
End If
End Sub

Since ckbPortrait is a checkbox, it can only have a value of True (Yes) or
False (No), so you can simplify the If statement to just:
If ckbPortrait Then
The longer version may make it simpler to understand when you re-visit it
later ;-)

HTH,

Rob


Bob V said:
Private Sub cbCategory_Click()
DoCmd.OpenReport "rptPrintMainCategoryRemark", acViewPreview
End Sub

This is what I have at the moment but would like to change it too, My
Checkbox Yes/No [ckbPortrait] on record source of My form
:
Private Sub cbCategory_Click()
If ckbPortrait =True, DoCmd.OpenReport "rptPrintMainCategoryRemarkPort",
acViewPreview
or
If ckbPortrait = False, DoCmd.OpenReport "rptPrintMainCategoryRemark",
acViewPreview
End Sub

Thanks for any help.....Bob
 
oops sorry took away the comer....Thanks Bob

Rob Parker said:
Private Sub cbCategory_Click()
If ckbPortrait = True Then
DoCmd.OpenReport "rptPrintMainCategoryRemarkPort", acViewPreview
Else
DoCmd.OpenReport "rptPrintMainCategoryRemark",
End If
End Sub

Since ckbPortrait is a checkbox, it can only have a value of True (Yes) or
False (No), so you can simplify the If statement to just:
If ckbPortrait Then
The longer version may make it simpler to understand when you re-visit it
later ;-)

HTH,

Rob


Bob V said:
Private Sub cbCategory_Click()
DoCmd.OpenReport "rptPrintMainCategoryRemark", acViewPreview
End Sub

This is what I have at the moment but would like to change it too, My
Checkbox Yes/No [ckbPortrait] on record source of My form
:
Private Sub cbCategory_Click()
If ckbPortrait =True, DoCmd.OpenReport "rptPrintMainCategoryRemarkPort",
acViewPreview
or
If ckbPortrait = False, DoCmd.OpenReport "rptPrintMainCategoryRemark",
acViewPreview
End Sub

Thanks for any help.....Bob
 
Rob, Tried it with this print option but got an error:
"You can not set Record Source property in print preview or after printing
has started"
Thanks for any help...bob

Private Sub cbCategory_Click()

If ckbPortrait = True Then
DoCmd.OpenReport "rptPrintRemarksPort", acViewPreview, , , ,
"Category Print Remark of Horse"
Else
DoCmd.OpenReport "rptPrintRemarks", acViewPreview, , , , "Category
Print Remark of Horse"
End If
End Sub

Bob V said:
oops sorry took away the comer....Thanks Bob

Rob Parker said:
Private Sub cbCategory_Click()
If ckbPortrait = True Then
DoCmd.OpenReport "rptPrintMainCategoryRemarkPort", acViewPreview
Else
DoCmd.OpenReport "rptPrintMainCategoryRemark",
End If
End Sub

Since ckbPortrait is a checkbox, it can only have a value of True (Yes)
or False (No), so you can simplify the If statement to just:
If ckbPortrait Then
The longer version may make it simpler to understand when you re-visit it
later ;-)

HTH,

Rob


Bob V said:
Private Sub cbCategory_Click()
DoCmd.OpenReport "rptPrintMainCategoryRemark", acViewPreview
End Sub

This is what I have at the moment but would like to change it too, My
Checkbox Yes/No [ckbPortrait] on record source of My form
:
Private Sub cbCategory_Click()
If ckbPortrait =True, DoCmd.OpenReport "rptPrintMainCategoryRemarkPort",
acViewPreview
or
If ckbPortrait = False, DoCmd.OpenReport "rptPrintMainCategoryRemark",
acViewPreview
End Sub

Thanks for any help.....Bob
 
The problem with this code:

If ckbPortrait = True Then
DoCmd.OpenReport "rptPrintRemarksPort", acViewPreview, , , , "Category
Print Remark of Horse"
Else
DoCmd.OpenReport "rptPrintRemarks", acViewPreview, , , , "Category
Print Remark of Horse"

is that you have the DoCmd.OpenReport taking 6 arguments, when it only
accepts 4 arguments!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
Hi Bob,

Looks like it is something that is happening *after* the report has been
opened, possibly something to do with the OpenArgs "Category Print Remark of
Horse". What is "Category Print Remark of Horse" ?

Regards
Jacob


| Rob, Tried it with this print option but got an error:
| "You can not set Record Source property in print preview or after printing
| has started"
| Thanks for any help...bob
|
| Private Sub cbCategory_Click()
|
| If ckbPortrait = True Then
| DoCmd.OpenReport "rptPrintRemarksPort", acViewPreview, , , ,
| "Category Print Remark of Horse"
| Else
| DoCmd.OpenReport "rptPrintRemarks", acViewPreview, , , , "Category
| Print Remark of Horse"
| End If
| End Sub
|
| | > oops sorry took away the comer....Thanks Bob
| >
| > message | >> Private Sub cbCategory_Click()
| >> If ckbPortrait = True Then
| >> DoCmd.OpenReport "rptPrintMainCategoryRemarkPort", acViewPreview
| >> Else
| >> DoCmd.OpenReport "rptPrintMainCategoryRemark",
| >> End If
| >> End Sub
| >>
| >> Since ckbPortrait is a checkbox, it can only have a value of True (Yes)
| >> or False (No), so you can simplify the If statement to just:
| >> If ckbPortrait Then
| >> The longer version may make it simpler to understand when you re-visit
it
| >> later ;-)
| >>
| >> HTH,
| >>
| >> Rob
| >>
| >>
| >> | >>>
| >>> Private Sub cbCategory_Click()
| >>> DoCmd.OpenReport "rptPrintMainCategoryRemark", acViewPreview
| >>> End Sub
| >>>
| >>> This is what I have at the moment but would like to change it too, My
| >>> Checkbox Yes/No [ckbPortrait] on record source of My form
| >>> :
| >>> Private Sub cbCategory_Click()
| >>> If ckbPortrait =True, DoCmd.OpenReport
"rptPrintMainCategoryRemarkPort",
| >>> acViewPreview
| >>> or
| >>> If ckbPortrait = False, DoCmd.OpenReport "rptPrintMainCategoryRemark",
| >>> acViewPreview
| >>> End Sub
| >>>
| >>> Thanks for any help.....Bob
| >>>
| >>
| >>
| >
| >
|
|
 
Thanks Jacob.............Bob
Case "Category Print Remark of Horse"

strSQL = "SELECT * FROM tblRemarks WHERE HorseID=" _
& Form_frmHorseInfo.tbHorseID.value & " and Category='" &
Form_frmHorseInfo.cbCategory & "' ORDER BY dtDate DESC,tblRemarks.Remark
ASC;"
SrNo.ControlSource = "SrNo"
tbHorseName.Visible = True
SrNo.Visible = True
tbDate.Visible = True
lblDate.Visible = True

lblRemarkID.Visible = False
tbRemarkID.Visible = False
tbHorseName.ControlSource = "=[Forms]![frmHorseInfo]![tbNameToDisplay]"
tbRemarks.Visible = False
tbRemarkID.ControlSource = ""
tbHorseName.Visible = True

JK said:
Hi Bob,

Looks like it is something that is happening *after* the report has been
opened, possibly something to do with the OpenArgs "Category Print Remark
of
Horse". What is "Category Print Remark of Horse" ?

Regards
Jacob


| Rob, Tried it with this print option but got an error:
| "You can not set Record Source property in print preview or after
printing
| has started"
| Thanks for any help...bob
|
| Private Sub cbCategory_Click()
|
| If ckbPortrait = True Then
| DoCmd.OpenReport "rptPrintRemarksPort", acViewPreview, , , ,
| "Category Print Remark of Horse"
| Else
| DoCmd.OpenReport "rptPrintRemarks", acViewPreview, , , , "Category
| Print Remark of Horse"
| End If
| End Sub
|
| | > oops sorry took away the comer....Thanks Bob
| >
| > message | >> Private Sub cbCategory_Click()
| >> If ckbPortrait = True Then
| >> DoCmd.OpenReport "rptPrintMainCategoryRemarkPort",
acViewPreview
| >> Else
| >> DoCmd.OpenReport "rptPrintMainCategoryRemark",
| >> End If
| >> End Sub
| >>
| >> Since ckbPortrait is a checkbox, it can only have a value of True
(Yes)
| >> or False (No), so you can simplify the If statement to just:
| >> If ckbPortrait Then
| >> The longer version may make it simpler to understand when you
re-visit
it
| >> later ;-)
| >>
| >> HTH,
| >>
| >> Rob
| >>
| >>
| >> | >>>
| >>> Private Sub cbCategory_Click()
| >>> DoCmd.OpenReport "rptPrintMainCategoryRemark", acViewPreview
| >>> End Sub
| >>>
| >>> This is what I have at the moment but would like to change it too,
My
| >>> Checkbox Yes/No [ckbPortrait] on record source of My form
| >>> :
| >>> Private Sub cbCategory_Click()
| >>> If ckbPortrait =True, DoCmd.OpenReport
"rptPrintMainCategoryRemarkPort",
| >>> acViewPreview
| >>> or
| >>> If ckbPortrait = False, DoCmd.OpenReport
"rptPrintMainCategoryRemark",
| >>> acViewPreview
| >>> End Sub
| >>>
| >>> Thanks for any help.....Bob
| >>>
| >>
| >>
| >
| >
|
|
 
Back
Top