Print Selected records of a form by clicking a command button.

raktims

Registered User.
Local time
Today, 09:22
Joined
Jul 29, 2003
Messages
19
Hi- I am new to this forum. Can someone tell me how to print selected records from a form and then print the selected record by clicking a button on the form.

This can easily be done if the File-Print option is used from th Menu where s"elected records" radio can be used for the purpose. But if I have to select some records in the formview and then click a button on the form to print just those records seems to be a problem. I can either print the whole form or just one record(the current record). It ignores the selection.

I would appreciate some help.
Raktim
 
I have no idea, but I sure someone else does....at least this will bump this up to the top of the list though!
 
Thanks Steve. I am still struggling with the problem. I would definitely appreciate some help from anyone.
Raktim.
 
I am having the same trouble. There is a DoCmd.OpenReport in VBA that has a Filter as well as a Where selection. The Filter selection has to have querys set up that filters the records you are wanting to print. The Where selection is the one I am needing to use but can not quite figure out how to do this.
First one that figures this out or gets help will let the other one know ok?

Best of luck with your Project.

Robert M
 
Don't know if you have gotten your problem solved, but here is what I wound up doing.
I added a Yes/No field in my table called PrntRpt
I use PrntRpt in my form to check the records that I am wanting to print
I then have a button to Print what I have selected, of course I display what I am getting ready to print first to check that I have everything correct.

Here is the program


Private Sub cmdPrntRpt_Click()
On Error GoTo Err_cmdPrntRpt_Click

'Create the varibables used in the program
Dim stDocName As String
Dim PrntRpt As Boolean

'Refresh the form so that All selections are set
Me.Refresh

'This is a little if then statement that I use because I have to print two types of reports on the records selected.
If Check19 = -1 Then
'Set stDocName variable to Report Name.
stDocName = "CPEReport-Forecasts"
'Create Report in Preview mode with only the PrntRpt equal to -1 (or True)
docmd.OpenReport stDocName, acPreview, , "PrntRpt = -1"
Else
stDocName = "CPEReport"
docmd.OpenReport stDocName, acPreview, , "PrntRpt = -1"
End If
'Error Catcher (this is automatically put in when I use the button wizard)
Exit_cmdPrntRpt_Click:
Exit Sub
Err_cmdPrntRpt_Click:
MsgBox Err.Description
Resume Exit_cmdPrntRpt_Click

End Sub

If you have already solved your problem let me know what your solution was.

Robert M
 

Users who are viewing this thread

Back
Top Bottom