By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,327 Members | 1,950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,327 IT Pros & Developers. It's quick & easy.

Report opening

P: n/a
I have a form with 2 fields on it, one for directorate and the other
for quarter's i.e. 1,2,3,4

if a certain directorate and quarter is selected go and get a certain
report, that I have built from a query.

Where have I gone wrong - I tried to put it on a button, but this
didnt work, so I tried on the Afterupdate event on the Quart field but
this didnt work either.

Please help......

Elaine
If [Org] = "BSC Mold" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "BSC Mold Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes
ElseIf [Org] = "BSC Mold" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "BSC Mold Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Mold" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "BSC Mold Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Mold" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "BSC Mold Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _____________________'

If [Org] = "BSC Pontypool" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "BSC Pontypool Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Pontypool" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "BSC Pontypool Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Pontypool" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "BSC Pontypool Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Pontypool" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "BSC Pontypool Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ ________________________'
If [Org] = "BSC Swansea" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "BSC Swansea Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Swansea" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "BSC Swansea Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Swansea" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "BSC Swansea Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Swansea" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "BSC Swansea Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ __________________________'
If [Org] = "Anglesey LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Anglesey LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Anglesey LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Anglesey LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Anglesey LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Anglesey LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Anglesey LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Anglesey LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ _________________________'

If [Org] = "Conwy LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Conwy LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Conwy LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Conwy LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Conwy LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ ___________________________'

If [Org] = "Flintshire LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Flintshire LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Flintshire LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Flintshire LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Flintshire LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Flintshire LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Flintshire LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Flintshire LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ ___________________________'

If [Org] = "Gwynedd LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Gwynedd LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Gwynedd LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Gwynedd LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Gwynedd LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Gwynedd LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Gwynedd LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Gwynedd LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ ______________________________'

If [Org] = "Denbighshire LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Denbighshire LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Denbighshire LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Denbighshire LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Denbighshire LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Denbighshire LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Denbighshire LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Denbighshire LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ _____________________________'

If [Org] = "Wrexham LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Wrexham LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Wrexham LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Wrexham LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Wrexham LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Wrexham LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Wrexham LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Wrexham LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ ____________________________'

If [Org] = "M&W" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "M&W Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "M&W" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "M&W Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "M&W" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "M&W Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "M&W" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "M&W Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _____________________________'
If [Org] = "SE" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "SE Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "SE" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "SE Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "SE" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "SE Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "SE" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "SE Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ ___________________________'

If [Org] = "NW" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "NW Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NW" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "NW Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NW" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "NW Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NW" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "NW Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ ___________________________'

If [Org] = "NWRO" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "NWRO Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NWRO" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "NWRO Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NWRO" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "NWRO Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NWRO" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "NWRO Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _____________________________'

If [Org] = "Conwy and Denbighshire" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Conwy and Denbighshire Quarter 1",
acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy and Denbighshire" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Conwy and Denbighshire Quarter 2",
acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy and Denbighshire" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Conwy and Denbighshire Quarter 3",
acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy and Denbighshire" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Conwy and Denbighshire Quarter 4",
acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ __________________________________'

If [Org] = "NEWT" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "NEWT Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NEWT" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "NEWT Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NEWT" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "NEWT Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NEWT" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "NEWT Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ ______________________________________'
If [Org] = "St H & K" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "St H & K Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "St H & K" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "St H & K Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "St H & K" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "St H & K Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "St H & K" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "St H & K Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes
End If
Dec 13 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Dec 13, 6:53 pm, Elainie <Elaine.Macint...@bsc.wales.nhs.ukwrote:
I have a form with 2 fields on it, one for directorate and the other
for quarter's i.e. 1,2,3,4

if a certain directorate and quarter is selected go and get a certain
report, that I have built from a query.

Where have I gone wrong - I tried to put it on a button, but this
didnt work, so I tried on the Afterupdate event on the Quart field but
this didnt work either.

Please help......

Elaine

If [Org] = "BSC Mold" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "BSC Mold Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Mold" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "BSC Mold Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Mold" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "BSC Mold Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Mold" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "BSC Mold Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _____________________'

If [Org] = "BSC Pontypool" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "BSC Pontypool Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Pontypool" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "BSC Pontypool Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Pontypool" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "BSC Pontypool Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Pontypool" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "BSC Pontypool Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ ________________________'

If [Org] = "BSC Swansea" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "BSC Swansea Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Swansea" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "BSC Swansea Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Swansea" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "BSC Swansea Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "BSC Swansea" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "BSC Swansea Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _________________________-_'

If [Org] = "Anglesey LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Anglesey LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Anglesey LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Anglesey LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Anglesey LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Anglesey LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Anglesey LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Anglesey LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ _________________________-'

If [Org] = "Conwy LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Conwy LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Conwy LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Conwy LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Conwy LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ _________________________-__'

If [Org] = "Flintshire LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Flintshire LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Flintshire LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Flintshire LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Flintshire LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Flintshire LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Flintshire LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Flintshire LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _________________________-__'

If [Org] = "Gwynedd LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Gwynedd LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Gwynedd LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Gwynedd LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Gwynedd LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Gwynedd LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Gwynedd LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Gwynedd LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _________________________-_____'

If [Org] = "Denbighshire LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Denbighshire LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Denbighshire LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Denbighshire LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Denbighshire LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Denbighshire LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Denbighshire LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Denbighshire LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ _________________________-____'

If [Org] = "Wrexham LHB" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Wrexham LHB Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Wrexham LHB" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Wrexham LHB Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Wrexham LHB" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Wrexham LHB Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Wrexham LHB" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Wrexham LHB Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ _________________________-___'

If [Org] = "M&W" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "M&W Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "M&W" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "M&W Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "M&W" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "M&W Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "M&W" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "M&W Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _________________________-____'

If [Org] = "SE" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "SE Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "SE" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "SE Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "SE" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "SE Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "SE" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "SE Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
'_________________________________________________ _________________________-__'

If [Org] = "NW" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "NW Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NW" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "NW Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NW" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "NW Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NW" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "NW Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _________________________-__'

If [Org] = "NWRO" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "NWRO Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NWRO" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "NWRO Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NWRO" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "NWRO Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NWRO" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "NWRO Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _________________________-____'

If [Org] = "Conwy and Denbighshire" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "Conwy and Denbighshire Quarter 1",
acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy and Denbighshire" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "Conwy and Denbighshire Quarter 2",
acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy and Denbighshire" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "Conwy and Denbighshire Quarter 3",
acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "Conwy and Denbighshire" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "Conwy and Denbighshire Quarter 4",
acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _________________________-_________'

If [Org] = "NEWT" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "NEWT Quarter 1", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NEWT" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "NEWT Quarter 2", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NEWT" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "NEWT Quarter 3", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "NEWT" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "NEWT Quarter 4", acViewPreview, , , acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If

'_________________________________________________ _________________________-_____________'

If [Org] = "St H & K" And [Quart] = "Quarter 1" Then
DoCmd.OpenReport "St H & K Quarter 1", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "St H & K" And [Quart] = "Quarter 2" Then
DoCmd.OpenReport "St H & K Quarter 2", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "St H & K" And [Quart] = "Quarter 3" Then
DoCmd.OpenReport "St H & K Quarter 3", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

ElseIf [Org] = "St H & K" And [Quart] = "Quarter 4" Then
DoCmd.OpenReport "St H & K Quarter 4", acViewPreview, , ,
acWindowNormal
DoCmd.Close acForm, "OrgQuarter", acSaveYes

End If
Elaine,
you could use the [Quart] On exit event but I would use a cmd button
rather than the On exit event.
then check that both controls are not null, then assign the content of
the controls to a variable
then use that as the report name

Dim strRptName as string
If not isnull(Org) and not is null(Quart) then
strRptName = Me![Org] & Me![Quart]
DoCmd.openreport strRptname, acpreview
else
msgbox"Please enter an Organisation and Quarter to preview a report",
vbOKonly, "Incomplete Data"
Exit Sub

End If

this assumes that the contents of the controls are limited to valid
report names
you may be better to use combo boxes for the controls with value lists
and the Limit to List property set to yes..

Hope that helps..
Dec 13 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.