UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Printing Multiple Reports From One Button, Access 2013    
 
   
PBear
post Dec 29 2017, 04:35 PM
Post#1



Posts: 29
Joined: 28-July 13



Hello all,

Need some assistance to figure out why my code is getting hung up on the second report. I am a beginner at VBA using 2013 but am trying to get a better understanding of it as I go.

Here is what I have

Private Sub Command179_Click()
DoCmd.OpenReport "(USO1) Map Reading Exam", acNormal, , "[ClassNumber]=" & Me.ClassNumber
DoCmd.OpenReport "(USO1) Map Reading Score Card", acNormal, , "[ClassNumber]=" & Me.ClassNumber
End Sub

I have a similar button on my db that prints 7 different reports successfully but when I created that I used " & Me.StudentID for them all. I believe my issue is in ----- " & Me.ClassNumber as when it gets to the second report the database shuts down.

Any help would be appreciated

Thanks
Go to the top of the page
 
theDBguy
post Dec 29 2017, 04:47 PM
Post#2


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Just curious... What happens if you flip the order of the reports? Would it still shut down on the second report or will it shut down on the first one this time?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
PBear
post Dec 29 2017, 05:28 PM
Post#3



Posts: 29
Joined: 28-July 13



Hi DBguy,

I took out the first report to see if it would run just that one report but it still makes the DB stop. I am sure it has something to do with it not finding the cbo info that opens the report.

In the query that the info comes from has the criteria [Forms]![Class Select]![Combo1] under the ClassNumber column.

I dont think it crashes on the first one as I put the print btn on that report.


UPDATE----

I just put a btn on the other report and it prints the active report but crashes on the second (not active). Guess this is just one of those automations that they will have to live without. ( Unless I figure out how to add the scorecard as a second page on the exam report!!)
This post has been edited by PBear: Dec 29 2017, 05:36 PM
Go to the top of the page
 
theDBguy
post Dec 29 2017, 05:36 PM
Post#4


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Hi,

If you think the problem is with the report, try opening it manually just to see if it will.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
PBear
post Dec 29 2017, 05:42 PM
Post#5



Posts: 29
Joined: 28-July 13



All the reports work fine individually. I was just trying to find a way to print the reports for the same ClassNumber at once instead of having to have to run two processes manually.

Thanks for looking at it though.

If you happen to think of some other work around, I will try anything. Isn't that how we learn trial and error? smile.gif
Go to the top of the page
 
theDBguy
post Dec 29 2017, 06:23 PM
Post#6


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Will the report open using code if you use a hard-coded value for ClassNumber?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
PBear
post Jan 3 2018, 02:31 PM
Post#7



Posts: 29
Joined: 28-July 13



Back at the drawing board. Hope you all had a wonderful new year.


So I tried putting in the hard number (If you meant just putting in the ID number into the query?) The report still opens but when I go to print from the cmdbtn it still shuts access down.

I may just have to leave it as it is. It is functional, I was just seeing if I could improve on it.
Go to the top of the page
 
theDBguy
post Jan 3 2018, 02:53 PM
Post#8


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Hi,

I'm pretty sure it can be improved, but I can't tell you how without seeing it. Good luck!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
PBear
post Jan 4 2018, 12:24 PM
Post#9



Posts: 29
Joined: 28-July 13



DBguy,

I think I can solve my problem if it is possible to add columns to the report footer!! (Can not find anything on this so far though).

I have created the Score Card report as a sub-report but because the score card is in columns, the sub report now displays on several pages.....wasting paper.

Any suggestions?

Go to the top of the page
 
theDBguy
post Jan 4 2018, 12:29 PM
Post#10


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Hi,

No, sorry. I don't think any suggestions I may come up with would only be a stab in the dark since I cannot see what you're looking at. Are you able to post a sample version of your db showing only the necessary objects to understand the problem?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
PBear
post Jan 4 2018, 12:35 PM
Post#11



Posts: 29
Joined: 28-July 13



I will try to make a shell of what I have. I will have to strip out all the data that is in it first and add some sample data.

Thanks
Go to the top of the page
 
theDBguy
post Jan 4 2018, 12:36 PM
Post#12


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Thanks. It would help a lot towards us helping you.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
PBear
post Jan 4 2018, 02:43 PM
Post#13



Posts: 29
Joined: 28-July 13



So I have reduced this down to as far as I could. I have left the two main reports and created a trial report (Exam/Scorecard). Main Goal is to be able to print both reports at the same time.

Let me know if you have any questions.

Thanks for taking a look.
Attached File(s)
Attached File  Test_DB.zip ( 108.76K )Number of downloads: 1
 
Go to the top of the page
 
theDBguy
post Jan 5 2018, 12:35 PM
Post#14


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Thanks for posting a copy of your db. I hope this is sort of what you meant.


Attached File(s)
Attached File  Test_DB.zip ( 114.06K )Number of downloads: 2
 

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
PBear
post Jan 5 2018, 04:06 PM
Post#15



Posts: 29
Joined: 28-July 13



DBguy,

That looks like what I am trying to do. I tried to figure out how you made the report footer go into columns but don"t see any differences in the properties. I still need to print them on separate pages but that is an easy fix (insert page break).

Can you give me some insight to how you modified the footer?

Thanks

PBear
Go to the top of the page
 
theDBguy
post Jan 8 2018, 10:46 AM
Post#16


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Sorry for the delay... I created a new subreport set up to have three (3) columns and then I used it to replace your original subreport because I didn't want to modify yours.

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
PBear
post Jan 9 2018, 08:55 PM
Post#17



Posts: 29
Joined: 28-July 13



DBguy,

You are the man. You can mark this as solved. I don't know why I didn't think of that fix in the first place.

Thank you very much for your help. I'm sure I have other errors that you could easily fix but I want to try to research and troubleshoot a bit more first myself.

Thanks again
PBear.
Go to the top of the page
 
theDBguy
post Jan 9 2018, 09:31 PM
Post#18


Access Wiki and Forums Moderator
Posts: 71,915
Joined: 19-June 07
From: SunnySandyEggo


Hi,

You're welcome! Glad we could assist. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th April 2018 - 07:51 PM