I’m trying to make a report, which prints out invoices, print just ONE invoice. I have a “Print Invoice” button on my Student Form and I want it to just print that student’s invoice NOT every invoice. How do I do that? I’m so confused!
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Print ONE Invoice!
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Print ONE Invoice!
- This topic has 21 replies, 5 voices, and was last updated 24 years ago.
AuthorTopicWSJenniferS
AskWoody LoungerApril 25, 2001 at 7:54 pm #355423Viewing 4 reply threadsAuthorReplies-
WSplang99
AskWoody Lounger -
WSd_rasley
AskWoody LoungerApril 27, 2001 at 12:16 pm #524403I created a button on the form, with the command to print the current form only. The button’s display attribute was set to display only, so that it doesn’t get printed out with the rest of the form.
This is the VBA code behind the button (On Click [Event Procedure]):
Private Sub PrintCurrentRecord_Click() On Error GoTo Err_PrintCurrentRecord_Click DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection Exit_PrintCurrentRecord_Click: Exit Sub Err_PrintCurrentRecord_Click: MsgBox Err.Description Resume Exit_PrintCurrentRecord_Click End Sub
Fortunately, Access will write all of this for you. When you create the button, select Form Operations / Print Current Form for Category and Action. Place the button where it will not interfere with the remainder of the form, but will be convenient to activate.
-
WSBrian Swann
AskWoody LoungerApril 30, 2001 at 1:24 pm #524603Patrick, I think that’s essentially what we did:[indent]
strDocName = “Invoice”
strLinkCriteria = “[InvID]=” & Forms!Invoices_Subform!InvID
DoCmd.OpenReport strDocName, acViewNormal, , strLinkCriteria
[/indent] Jennifer was just having a little trouble locating the elements buried in various subforms but it all appears to be sorted out now.
-
WSRupert
AskWoody LoungerMay 14, 2001 at 8:19 pm #524176 -
WSJenniferS
AskWoody Lounger -
WSRupert
AskWoody LoungerApril 25, 2001 at 8:59 pm #524185 -
WSJenniferS
AskWoody Lounger -
WSBrian Swann
AskWoody Lounger -
WSJenniferS
AskWoody LoungerApril 26, 2001 at 2:52 pm #524278Okay, here’s all the code that is showing. I don’t know much about Visual Basic.
Sub LastName_AfterUpdate()
‘ Find the record that matches the control.
Me.RecordsetClone.FindFirst “[StudID] = ‘” & Me![LastName] & “‘”
Me.Bookmark = Me.RecordsetClone.Bookmark
End SubSub Combo33_AfterUpdate()
‘ Find the record that matches the control.
Me.RecordsetClone.FindFirst “[StudID] = ‘” & Me![Combo33] & “‘”
Me.Bookmark = Me.RecordsetClone.Bookmark
End SubPrivate Sub Cmd_Print_Current_Rec_Click()
On Error GoTo Err_Cmd_Print_Current_Rec_ClickDim strDocName As String
Dim strFilter As StringDoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 ‘Save record
strDocName = “Invoice”
strFilter = “tbl_Invoices.InvID = Forms!frm_Student!InvID”DoCmd.OpenReport strDocName, acViewNormal, , strFilter
Exit_Cmd_Print_Current_Rec_Click:
Exit SubErr_Cmd_Print_Current_Rec_Click:
MsgBox Err.Description
Resume Exit_Cmd_Print_Current_Rec_ClickEnd Sub
I don’t know what the other two SUBs are, though ’cause like I said, I don’t know much of anything about VBA. I hope you can help.
Jennifer
-
WSBrian Swann
AskWoody LoungerApril 26, 2001 at 3:18 pm #524279Not knowing exactly how your form and report are structured, I’m assuming the form contains a control [InvID] and can be linked to the “Invoice” report using that unique identifier. If not you might try [StudID]
[indent]
Dim stDocName As String
Dim stLinkCriteria As StringstLinkCriteria = “[InvID]=” & Me![InvID]
stDocName = “Invoice”DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
[/indent]
-
WSJenniferS
AskWoody Lounger -
WSBrian Swann
AskWoody LoungerApril 26, 2001 at 6:11 pm #524302Sorry Jennifer, just replace this whole procedure:
[indent]
Private Sub Cmd_Print_Current_Rec_Click()
On Error GoTo Err_Cmd_Print_Current_Rec_ClickDim strDocName As String
Dim strFilter As StringDoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 ‘Save record
strDocName = “Invoice”
strFilter = “tbl_Invoices.InvID = Forms!frm_Student!InvID”DoCmd.OpenReport strDocName, acViewNormal, , strFilter
Exit_Cmd_Print_Current_Rec_Click:
Exit SubErr_Cmd_Print_Current_Rec_Click:
MsgBox Err.Description
Resume Exit_Cmd_Print_Current_Rec_ClickEnd Sub
[/indent]With this ….
Private Sub Cmd_Print_Current_Rec_Click()
On Error GoTo Err_Cmd_Print_Current_Rec_ClickDim strDocName As String
Dim stLinkCriteria As StringDoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 ‘Save record
strDocName = “Invoice”
stLinkCriteria = “[InvID]=” & Me![InvID]DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_Cmd_Print_Current_Rec_Click:
Exit SubErr_Cmd_Print_Current_Rec_Click:
MsgBox Err.Description
Resume Exit_Cmd_Print_Current_Rec_ClickEnd Sub
Then cross your fingers .
-
WSJenniferS
AskWoody Lounger -
WSBrian Swann
AskWoody Lounger -
WSJenniferS
AskWoody Lounger -
WSJenniferS
AskWoody Lounger -
WSBrian Swann
AskWoody LoungerApril 27, 2001 at 5:40 pm #524434Jennifer sorry you’re having so much difficulty. I’ve been away not ignoring you. I think you’re very close. You’ve got to determine the Link. First, you are attempting to print a report, correct? If so, in the query underlying the report you do have a field InvID, correct? If that’s true, all you should need to do is locate InvID in the form. You have what sounds like a main form and two subforms. When you determine the name of the subform containing the InvID insert it in the stLinkCriteria line.
-
WSJenniferS
AskWoody LoungerApril 27, 2001 at 6:58 pm #524438Now I get a syntax error in this line:
stLinkCriteria = “[InvID]=” & Forms!Invoices Subform!InvID
What did I do wrong? This is really driving me crazy!
…okay, now I don’t get the syntax error, but now it can’t find the form “Invoices_Subform”. But I DO have a form called “Invoices Subform”(I noticed that it syntaxed because I had no “_” in there). Why can’t it find my subform?
…okay. I fiddled with it some more. Now I actually got it to print my one invoice! Yeh, I’m doing the happy dance! But now, how do I get it just to print instead of preview it first?
Jennifer
-
WSBrian Swann
AskWoody Lounger -
WSJenniferS
AskWoody Lounger
-
-
-
-
WSJenniferS
AskWoody LoungerViewing 4 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
What is wrong with simple approach?
by
WSSpoke36
2 minutes ago -
Worrying about how to Backup Yahoo Emails? Try the Yahoo Backup Tool! (Awaiting moderation)
by
jules28
2 hours, 47 minutes ago -
Worrying about how to Backup Yahoo Emails? Try the Yahoo Backup Tool! (Awaiting moderation)
by
jules28
2 hours, 49 minutes ago -
Is Aegean Airlines Safe to Fly? A Complete Safety Guide (Awaiting moderation)
by
jacksmith243
4 hours, 36 minutes ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
6 hours, 30 minutes ago -
Location, location, location
by
Susan Bradley
6 hours, 59 minutes ago -
Cannot get a task to run a restore point
by
CWBillow
7 hours, 56 minutes ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
2 hours, 54 minutes ago -
June 2025 Office non-Security Updates
by
PKCano
18 hours, 42 minutes ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
45 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
18 hours, 38 minutes ago -
How start headers and page numbers on page 3?
by
Davidhs
1 day, 5 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
7 hours, 44 minutes ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
1 day, 13 hours ago -
Windows 11 Insider Preview build 26120.4230 (24H2) released to BETA
by
joep517
1 day, 13 hours ago -
MS Excel 2019 Now Prompts to Back Up With OneDrive
by
lmacri
1 day, 3 hours ago -
Firefox 139
by
Charlie
20 hours, 1 minute ago -
Who knows what?
by
Will Fastie
10 hours, 22 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
1 day, 14 hours ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
1 day, 8 hours ago -
Misbehaving devices
by
Susan Bradley
10 hours, 11 minutes ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
2 days, 20 hours ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
17 hours, 45 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
2 days, 18 hours ago -
Discover the Best AI Tools for Everything
by
Alex5723
1 day, 18 hours ago -
Edge Seems To Be Gaining Weight
by
bbearren
2 days, 9 hours ago -
Rufus is available from the MSFT Store
by
PL1
2 days, 17 hours ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
3 days, 20 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
1 day, 19 hours ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
1 day, 18 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.