PrintOut/Run-time error 2585 (1 Viewer)

chuckgoss

Registered User.
Local time
Today, 12:45
Joined
Mar 26, 2001
Messages
44
Hello,
Perhaps someone can help me with this one. I am trying to have a 'current' form print automaticly when the form has been filled out completly. The last event that properly happens on the form is that a Pop-up form appears and prompts the user to take action from there. The print code needs to run before the pop up form appears, but however I try to get it to print, I get: "Run-time error 2585 - This action can't be carried out while processing a form or report event"

The code I've been using is:
DoCmd.PrintOut acSelection, , , acHigh

I have tried it at lost focus, got focus, and after update of different controls on the form. FYI, the Pop-up form opens upon got focus of the last control, and both of the last 2 controls on the 1st form are locked.

thanks,
chuck
 

ElsVanMiert

Registered User.
Local time
Today, 12:45
Joined
Dec 14, 2000
Messages
152
You should really use a report instead of a form to print your data.
 

chuckgoss

Registered User.
Local time
Today, 12:45
Joined
Mar 26, 2001
Messages
44
Thanks for your quick responses:

Rich: The reason the print requirement needs to be before the Pop-up form, is that I want to print the data that was entered onto the first Form. The Pop-up form offers the choices: I'm done returning parts, and I have more parts to return. I don't want to print a snapshot of that screen.

ElsVanMiert: The reason for printing out the form with the data on it, is that it contains information such as Part Number, Description of the part, Machine type, Model, and it's original shelf location...to where it will be returned once again. The information on the form contains data from 2 different records when it is filled out. This printed sheet accompanies the part (which can often be hard to identify by simply looking at it) so that the warehouse person can properly re-package it and label it for it's return back into inventory

P.S. Just prior to this reply to you both, I removed the command that calls up the Pop-up form, so that the print command would be the last action that would be performed on the form in the hope that I would escape the bit about can't print while processing the form. There was no change in the problem. I still got the same message.

thanks,
chuck
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:45
Joined
Feb 19, 2002
Messages
43,275
You need to force the current record to be saved.

DoCmd.RunCommand acCmdSaveRecord
 
R

Rich

Guest
Yes you can't actually carry out printing the form because you have interrupted the process.
In the after update/lost focus event of the control that contains the code to open your pop up form put Me.Refresh then DoCmd open form etc.
Add the print form event to a button on the second form although you will have to change the reference to the first form.
Els is correct though you should really use a report to print your slip, you can actually save the form as a report although you may have to tidy it up a little.
HTH
 

chuckgoss

Registered User.
Local time
Today, 12:45
Joined
Mar 26, 2001
Messages
44
Thanks Els, Pat, and Rich...

When Els mentioned that I should use a report instead of the form to print my data, it sounded great but I didn't know how to do that. Your comment, Rich, about saving it as a report, helped point me to investigate that a little bit, and has pointed me in that better dirrection. I now have a report that looks like my form. I'll try and print that instead of the method I was using. The Save Record piece was already in place, and provided no solution. I tried the Me.Refresh and then print [the form] piece just before this post, and it was not a fix either. Actually, I did not get an error, it's just that nothing printed at all. So much learning! It's great!

Thanks again for all the help.

chuck
 

Users who are viewing this thread

Top Bottom