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

Handle Multple Reportint Options

P: 9
it has been working excellently but I found a problem
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "RptSnapplingA5", _
  2.    acViewPreview, , _
  3.    "[Work]=-1", , _
  4.    "this is the title"
  5. [Reports]![RptSnapplingA5]![Notes].Visible = False
since I have another line that for this button hides the notes, the title also disappears
any other solutions for that - thanks a million
dovid

<This thread was split from>
set title of report based on button clicked on in the main form
Jan 8 '15 #1

✓ answered by Seth Schrock

The name itself wouldn't get passed through the OpenArgs, but a number which identifies the report name would. Thus in the code that he provided, you would replace "Report 1" with your report name that you associate with the number 1.

Share this Question
Share on Google+
9 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,486
If you don't want the notes to be visible, why not remove the control?
Jan 8 '15 #2

P: 9
I have 3 buttons on the main form
1 button prints with the notes, 2 print without notes
I use that Idea a lot, printing for me with notes, for the customer without etc. I can make separate reports, I was wondering if there is another way
thanks
Jan 8 '15 #3

twinnyfo
Expert Mod 2.5K+
P: 3,486
Working with our usage of OpenArgs, how about sending an integer (1, 2 or 3).

Then, in your Report's OnOpen Event:

Expand|Select|Wrap|Line Numbers
  1. Select Case Me.OpenArgs
  2.     Case 1
  3.         Me.Title5 = "Report 1"
  4.         Me.Notes.Visible = True
  5.     Case 2
  6.         Me.Title5 = "Report 2"
  7.         Me.Notes.Visible = True
  8.     Case 3
  9.         Me.Title5 = "Report 3"
  10.         Me.Notes.Visible = False
  11. End Select
This allows you much more flexibility with your various controls.
Jan 8 '15 #4

Seth Schrock
Expert 2.5K+
P: 2,951
Another option would be to send multiple sections separated by a colon in the OpenArgs, like this
Expand|Select|Wrap|Line Numbers
  1. "This is the title:True"
Then the Report's Load event can use the Split function to get the different parts.
Expand|Select|Wrap|Line Numbers
  1. Dim strArgs() As String
  2. strArgs = Split(Me.OpenArgs, ":")
  3.  
  4. Me.Title5 = strArgs(0)
  5.  
  6. If strArgs(1) = "True" Then
  7.     Me.Notes.Visible = True
  8. Else
  9.     Me.Notes.Visible = False
  10. End If
In this case twinnyfo's solution might be easiest, but this solution would work better if you can't really plan what the options would be.
Jan 8 '15 #5

P: 9
I don't see how twinnyfo's solution helps
from what I understand, we still don't have the title being defined as me.title = OpenArgs
we only have worked out whether the notes are visible or not in the onload rather than on the button that opens it.
am I wrong?
Jan 8 '15 #6

Seth Schrock
Expert 2.5K+
P: 2,951
The name itself wouldn't get passed through the OpenArgs, but a number which identifies the report name would. Thus in the code that he provided, you would replace "Report 1" with your report name that you associate with the number 1.
Jan 8 '15 #7

P: 9
didn't get the split function to work at all
never got the title to show only half of the string - I still want to play with the function but any input would be appreciated
dovid
Jan 8 '15 #8

Seth Schrock
Expert 2.5K+
P: 2,951
What was the title that you wanted to see? Did it include a colon? If it did, then you just need to change the character that you are using to split the string.
Jan 8 '15 #9

P: 9
I redid everything and it worked, don't know what happened the first time. it has given me new ways to work with access, thanks for everything
Jan 9 '15 #10

Post your reply

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