By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

Print Report With Two Parameters

P: 12
I have created a report which opens with a click button and utilizes two parameters using the following string:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Doc2019_View_Click()
  2.  
  3.     Dim stDocName As String
  4.     Dim stLinkCriteria As String
  5.  
  6.     stDocName = "B_Edit"
  7.     stLinkCriteria = "[ac]=" & "'" & Me![ac] & _
  8.                  "' And [nr]=" & "'" & Me![nr] & "'"
  9.  
  10.     DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
  11.  
  12. End Sub
  13.  
Works fine. But when attempting to create a Print Button to print the report without previewing it doesn't work. Why?
Feb 25 '19 #1
Share this Question
Share on Google+
1 Reply


P: 12
Sorry was doing a very stupid mistake which has been fixed:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Doc2019_View_Click()
  2.  
  3.     Dim stDocName As String
  4.     Dim stLinkCriteria As String
  5.  
  6.     stDocName = "B_Edit"
  7.     stLinkCriteria = "[ac]=" & "'" & Me![ac] & _
  8.                  "' And [nr]=" & "'" & Me![nr] & "'"
  9.  
  10.     DoCmd.OpenReport stDocName,,, stLinkCriteria
  11.  
  12. End Sub
  13.  
Now works!
Feb 25 '19 #2

Post your reply

Sign in to post your reply or Sign up for a free account.