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
-
Office gets current release
by
Susan Bradley
2 hours, 55 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
19 hours, 27 minutes ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
3 hours, 58 minutes ago -
Stop the OneDrive defaults
by
CWBillow
20 hours, 16 minutes ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 day, 6 hours ago -
X Suspends Encrypted DMs
by
Alex5723
1 day, 8 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
1 day, 8 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
1 day, 9 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
1 day, 9 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
22 hours, 5 minutes ago -
Enabling Secureboot
by
ITguy
1 day, 5 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
1 day, 17 hours ago -
No more rounded corners??
by
CWBillow
1 day, 13 hours ago -
Android 15 and IPV6
by
Win7and10
1 day, 3 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
2 days, 6 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
2 days, 8 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 3 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
2 days, 16 hours ago -
May preview updates
by
Susan Bradley
2 days, 3 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
1 day, 19 hours ago -
Just got this pop-up page while browsing
by
Alex5723
2 days, 8 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
2 days, 5 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
1 day, 7 hours ago -
At last – installation of 24H2
by
Botswana12
3 days, 7 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
5 hours, 27 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
3 days, 19 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
1 day, 18 hours ago -
Limited account permission error related to Windows Update
by
gtd12345
4 days, 9 hours ago -
Another test post
by
gtd12345
4 days, 9 hours ago -
Connect to someone else computer
by
wadeer
10 hours, 47 minutes 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.