Thread: Print Direct (2003)
2008-05-23, 12:27 #1
- Join Date
- May 2003
- Sheffield, Yorkshire
- Thanked 0 Times in 0 Posts
Print Direct (2003)
How do I print a report from a form for the current record open. At the moment a button is pressed, and a query will ask for the Serial number. I have been asked for it print the current record.
Subscribe to our Windows Secrets Newsletter - It's Free!
Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!
+ Get this BONUS — free!
Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!
2008-05-23, 12:34 #2
- Join Date
- Mar 2002
- Thanked 16 Times in 16 Posts
Re: Print Direct (2003)
Does the record source of the form have a field that uniquely identifies the record? Let's say it is named ID and that it is a number field.
You can then use code like this:
Private Sub cmdReport_Click()
DoCmd.OpenReport ReportName:="rptMyReport", WhereCondition:="ID=" & Me.ID
If the ID field is a text field, change the above to
..., WhereCondition:="ID=" & Chr(34) & Me.ID & Chr(34)
and if it is a date field, to
..., WhereCondition:="ID=#" & Format(Me.ID, "mm/dd/yyyy") & "#"