Print single record in report (1 Viewer)

maintt

New member
Local time
Today, 16:00
Joined
Jun 15, 2010
Messages
8
Hi all

I have a report which shows all clients, i want to print off the same report one record only, is this possible?

many thanks

maintt
 

Trevor G

Registered User.
Local time
Today, 16:00
Joined
Oct 1, 2009
Messages
2,341
Hi all

I have a report which shows all clients, i want to print off the same report one record only, is this possible?

many thanks

maintt


How did you get on with single record being printed?

If you are still needing help suggestion is as follows:

Open your form in design view, then Press F11 on the keyboard to open the Navigation Pane. Then Select MACROS. In macros create a new macro, then select the action to open a report, in the arguments below select the report to open, change the Print option to Preview and below there you will see conditons. In the conditions select the elipses button to the right it will open the build wizard, then select table section and find your table then in the next column select a field which will hold unique information like an id field, then place in the = (equal sign), then select the form section and find your open form in design view, and in the middle column select the ID field.

Save and and close the macro.

Then drag the macro into your form (it will create a button for you), then save your form, change the view and when you have selected a record you want to preview click the button.
 

robhoek

New member
Local time
Today, 17:00
Joined
Nov 22, 2011
Messages
3
Hey,

I have a problem. I'm using Access 2010 and I'm trying to print a report of one specific record. It should be the record I'm viewing in the form. I've tried all the things posted here, but it does not work. Access either asks me to fill in the ID myself or it just says the where condition is invalid. My form is named: "Invoeropkomsten", my ID field is called: "Opkomstid" and my report is named: "qryOpkomst" (These are dutch names). Let's say I make a macro to print the current record. I fill in exactly these things:

Report name: qryOpkomst
View: Print Preview
Filter name:
Where Condition: "[Opkomstid] = " & Me![Opkomstid]
Window Mode: Normal

What am I doing wrong?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:00
Joined
Aug 30, 2003
Messages
36,126
The link I posted above uses VBA code, not a macro. You can't use Me in a macro, so you'd have to use the full form reference. Personally I'd switch to code, unless you're creating a web database.
 

robhoek

New member
Local time
Today, 17:00
Joined
Nov 22, 2011
Messages
3
Thanks for the reply, But it still doesn't work. This is the code I've made in VBA:

Private Sub Command37_Click()

DoCmd.OpenReport "qryOpkomst", acViewPreview, , "Opkomstid = " & Me.Opkomstid

End Sub


I can't figure out what's wrong with it. Can anyone help me?

Rob
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:00
Joined
Aug 30, 2003
Messages
36,126
What does "doesn't work" mean, exactly? What is the data type of that field? Is that really the name of a report?
 

robhoek

New member
Local time
Today, 17:00
Joined
Nov 22, 2011
Messages
3
Doesn't work means that Access still asks me for a value for Opkomstid and if I fill in a valid number, it shows all the records instead of the one I want. The type of Opkomstid is Autonumber and yes, qryOpkomst is realy the name of a report. It is automatically made from a query that is also named qryOpkomst. But that is not the problem, because when I just renamed the report to rptOpkomst, it still didn't work.

Rob
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:00
Joined
Aug 30, 2003
Messages
36,126
If it's asking for a value, one of those names is incorrect, or that isn't. Field in the report's source.
 

ER2013

New member
Local time
Today, 08:00
Joined
Feb 6, 2013
Messages
1
Thanks Trevor, your instructions worked perfectly...I didn't see this question addressed in either of my Access 2010 books, so this is a big help.
 

CrazyCaper

New member
Local time
Today, 08:00
Joined
Mar 23, 2014
Messages
5
Good day folks I have been trying to do the same ...print a single record on a report I thought I had followed all the advice here but still can't get it to work the button works and actually prints but I am still getting all the records instead of the current record in the form I have the following behind the button on my form:

Private Sub Command64_Click()
End Sub
Private Sub Cmdprint_Click()
'print current record
'using rpt_workorders
If IsNull(Me!id_workorder) Then
MsgBox "Please Select a Valid Work Order", _
vbOKOnly, "Error"
Exit Sub
End If
DoCmd.OpenReport "rpt_workorders", acViewPreview, , _
"id_workorder= " & Me.id_workorder
End Sub

Any help would be greatly appreciated. Thanks in advance
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:00
Joined
Aug 30, 2003
Messages
36,126
Can you post the db here? That looks correct for a numeric data type.
 

Simon_MT

Registered User.
Local time
Today, 16:00
Joined
Feb 26, 2007
Messages
2,177
Another variation on the theme:

Code:
Function OriginalsImage_Report()

    With CodeContextObject
        DoCmd.OpenReport "Originals Images Large", acViewPreview, "", "[Orig Old Stock]=" & .[Orig Old Stock], acWindowNormal
    End With
End Function

Simon
 

CrazyCaper

New member
Local time
Today, 08:00
Joined
Mar 23, 2014
Messages
5
Please forgive the structure being a noobie I am sure there are some issues with it but here is the db the print function is located on the work order form. Thanks in advance for taking a look.
 

Attachments

  • DFO WO DB.zip
    543.4 KB · Views: 713

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:00
Joined
Aug 30, 2003
Messages
36,126
The code is intended to work on the main report. You have data in a subreport, though I can't see why.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:00
Joined
Aug 30, 2003
Messages
36,126
That code still wouldn't work. Why have you made it a subreport? Why not just a report?
 

CrazyCaper

New member
Local time
Today, 08:00
Joined
Mar 23, 2014
Messages
5
I followed the advise here and a how to and that's what I ended up with the idea is to create the work order in the form then be bale to print out that single work order
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:00
Joined
Aug 30, 2003
Messages
36,126
Try creating a report with the appropriate data. It looks like you dropped the form into a report, creating a subreport.
 

CrazyCaper

New member
Local time
Today, 08:00
Joined
Mar 23, 2014
Messages
5
Thanks for the help on this Paul it is much appreciated I will try your suggestion and let you know how I make out Thanks again
 

Users who are viewing this thread

Top Bottom