473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Report opening

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
1 1372
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob Quintal | last post by:
I have a report that prints a single record. Normally it's enter one record, then print it. This works great. New requirement: Each record needs to be printed to an individual ..pdf file from...
2
by: CSDunn | last post by:
Hello, I have an Access 2003 report that opens in print preview and then maximizes upon clicking a button from a form. The OnClick event of the button fires a macro to open the report. How can...
1
by: prabhukalyan | last post by:
Hi all, I am not so good in queries. here is my problem 2 tables to store the received items (fabric)-- inwardmaster, inwarddetails and after some processing (Dyeing) the items were...
1
by: rxfrenc | last post by:
Hello, I am trying to create a report that displays balance impacting inventory transactions. I can easily pull the current on-hand balance in one query and the transaction history in another...
2
by: Prakash | last post by:
I have 2 tables ... Customer_Master: Cust-Code, Cust_Name Customer_Transactions: Cust_Code, Date, Details, Debit, Credit I would like to generate a report in the foll manner, say from...
28
by: ryanhokanson | last post by:
I was just trying to get a list of all my reports along with their widths. I can't use the "Reports" collection because it only works on open reports. So I tried looking into the "AllReports"...
7
by: martin DH | last post by:
Hello, I have a report that I open that pull its data from a form that builds a where string. Opening the report first opens the form, where I enter criteria, and then pulls matching records from a...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
3
by: Naushad | last post by:
Hi All, I am trying to open the report conditionally from the dialogue box form. In the form there are three field. cboEmployees StartDate EndDate I have used these field in criteria to...
10
by: Snoopy33 | last post by:
I have a DB that I developed on access XP (2002) and deployed over a year ago. No one has had problems printing any of the reports within the DB until we started loading 2007 on new computers. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.