open report from combo

antonyx

Arsenal Supporter
Local time
Today, 20:47
Joined
Jan 7, 2005
Messages
556
Seasons Greetings to all.. I hope you didnt put on too much weight.

The fog at Heathrow ensured I had a very stressful Christmas.. but thankfully it has gone for now.

i have a question regarding choosing a report to open based on a combo list..

i have a field called jobtype..

this field will always have either
"CASH" or "ACCT"

i have 3 separate report designs.. 1 design for cash jobs, 1 design for acct jobs, and 1 deisgn for both jobs.

i want a form that will allow my user to choose which report to look at..

lets call it form1.. i want to place a combo on my form (combo1) that has the values..

CASH
ACCT
BOTH

i realise that in my report query source.. i can use the following as the jobtype criteria

[Forms]![form1]![combo1]..

Question

I need the combo to realise that if the CASH value is selected.. it should open the CASH report..

if the ACCT value is selected.. it should open the ACCOUNT report..

and finally if BOTH is selected then open the BOTH report..

how can i do this?
 
In the AfterUpdate event of the combo box, put:
Code:
Select Case Me.YourComboBoxNameHere

Case "Cash"
   DoCmd.OpenReport "YourCashReportNameHere", acPreview

Case "Acct"
   DoCmd.OpenReport "YourAcctReportNameHere", acPreview
Case "Both"
    DoCmd.OpenReport "YourCashReportNameHere", acPreview
    DoCmd.OpenReport "YourAcctReportNameHere", acPreview
End Select
This will work if your bound field in your combo box is the field that returns the text. If not, change the Select Case YourComboBoxName to
Select Case YourComboBoxName.Columns(1) or whatever number (minus 1) is the actual column with the appropriate text.
 
you legend.. let me give it a go..
 
ok i had it working but im gettin a small error Run-time '3211': now and ive tried changing the locks of the form but it is still there..

im sure its something very minor.. can you see why this is happening??
 

Attachments

im beginning to realise that tables are the pond and forms are the fishing rods and queries are the bait
 

Users who are viewing this thread

Back
Top Bottom