Printing Single Record Reports

Jkittle

Registered User.
Local time
Yesterday, 20:00
Joined
Sep 25, 2007
Messages
100
I have created a report using a query. How can I print a single record report while I'm in the form? I would like to be able to print the current record I have open.
 
The best way I can think of is to use the form records pk as a criteria on the reports query...

:)
ken
 
How do I do this? Do I have modify the query to ask for the pk. I've worked in Access databases in the past that would print a report for ever record you had open but I don't how it was done.
 
Yes - In the query just use the fully qualified control name on the form on the criteria row. Something like:

forms!myFormName!myTextBoName

:)
ken
 
Print Cmd

Can anyone tell me why this isn't working?

Private Sub cmdPrint_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ID] = """ & Me.[ID] & """"
DoCmd.OpenReport "R-NCM Red Tag", acViewPreview, , strWhere
End If
End Sub
 
Can anyone tell me why this isn't working?

Private Sub cmdPrint_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ID] = """ & Me.[ID] & """"
DoCmd.OpenReport "R-NCM Red Tag", acViewPreview, , strWhere
End If
End Sub


If you are going to check to see if it is a new record, you need to do it before setting the Me.Dirty= False or else I believe it won't be new anymore.
 
Print Issue (Help!)

Bob,

I'm still having an issue. I changed the code to:

Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

DoCmd.OpenReport "R-NCM Red Tag", acViewNormal, , "[ID] = " & Me.ID & ""

Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click

End Sub

Now it prints the report correct but adds a second page without the header. Why is it printing twice?
 
Check your spacing. Tighten up the items. You probably have blank space somewhere that is causing it to go to two pages.
 

Users who are viewing this thread

Back
Top Bottom