Report print rather than view...

Grafixx01

Registered User.
Local time
Today, 06:56
Joined
Nov 17, 2005
Messages
22
I have a form, rptReminders, that is based off a query with a listbox that displays the results of the query. The user can select desired tasks within the list and then click a command button to print the selected tasks with ALL the data from the record.

This DOES work, to a certain degree. It puts the records to the screen so they can be viewed rather than directly to the default printer of the user.

What I need it to do is to PRINT to the printer rather than the screen. I don't know how though.

The code behind the button is:

Code:
Private Sub cmdPrintSelection_Click()
'check to see if there are records selected to print on individual rptTask forms including
'all of the information on the records. If not, display message box saying user has to select
'at least one record to print.
Dim strSQL As String, strvalue As String, varItem As Variant
'Check to see i f the user has select an item from the list

If List21.ItemsSelected.Count = 0 Then
    MsgBox ("You Must Select at least one Task to print")
    Me.List21.SetFocus
Else
'Create the string which will be used as the criteria of the report
 strSQL = "Task_ID = "
 
'Cycle through items selected and add selected items as part of the string
  For Each varItem In Me.List21.ItemsSelected
    strSQL = strSQL & Me.List21.ItemData(varItem) & " OR Task_ID = "
  Next varItem

Debug.Print strSQL 'see SQL String before

'Trim the string
strSQL = Left$(strSQL, Len(strSQL) - 14)

Debug.Print strSQL 'see SQL string after

'Open the report rptStdHistPALL using the string criteria
DoCmd.OpenReport "rptTaskReminders", acViewPreview, , strSQL
End If
End Sub
 
What do you suppose this argument is doing?

DoCmd.OpenReport "rptTaskReminders", acViewPreview, , strSQL

I'll bet you could find another one in VBA Help that did what you want.
 
What do you suppose this argument is doing?

DoCmd.OpenReport "rptTaskReminders", acViewPreview, , strSQL

I'll bet you could find another one in VBA Help that did what you want.

change it to acviewnormal
 
Couldn't let him look in Help, eh?
 
Paul,

Actually, I looked at this post AFTER I was doing other things at work, and working on the db, I tried typing in the line of code in question again and saw the options under "ac...." and tried all of them until I got to "normal" and then it work!
 

Users who are viewing this thread

Back
Top Bottom