Re: Passing info to a report from a form
- From: fredg <fgutkind@xxxxxxxxxxxxxxx>
- Date: Mon, 18 Dec 2006 16:13:51 -0800
On Mon, 18 Dec 2006 10:58:02 -0800, Paul Kraemer wrote:
Hi Fred,
Thanks for your response.
I actually want to pass six different strings to be displayed in my report.
Do you know if I can pass an array into OpenArgs? If so, how do I reference
the individual elements of the array on my report?
Thanks again,
Paul
Assuming you are using a newer version of Access that includes the
Split() function.
First Copy and Paste the following Function into a Module:
Public Function ParseText(TextIn As String, x) As Variant
On Error Resume Next
Dim Var As Variant
Var = Split(TextIn, "|", -1)
ParseText = Var(x)
End Function
========
To pass the multiple OpenArgs when opening the report use the vertical
line character as text separator:
DoCmd.OpenReport "Report Name", acViewPreview, , , ,
"Hello|GoodBy|Mary|Lamb"
===========
Code the Declarations section of the report:
Option Explicit
Dim strA As String
Dim strB As String
Dim strC As String
Dim strD As String
===========
Code the Open event of the report
If Not IsNull(Me.OpenArgs) Then
strA = ParseText(OpenArgs, 0)
strB = ParseText(OpenArgs, 1)
strC = ParseText(OpenArgs, 2)
strD = ParseText(OpenArgs, 3)
' Then do what you want with the resulting strings
MsgBox strA & " " & strB & vbNewLine & strC & " " & strD
End If
Note: if you intend to use the strings elsewhere in your report,
instead of declaring the strings in the open event, do it in the
declarations section so that the strings will be available every where
in the report.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
.
- Follow-Ups:
- Re: Passing info to a report from a form
- From: Paul Kraemer
- Re: Passing info to a report from a form
- References:
- Re: Passing info to a report from a form
- From: fredg
- Re: Passing info to a report from a form
- From: Paul Kraemer
- Re: Passing info to a report from a form
- Prev by Date: Re: using large amounts of text in reports
- Next by Date: Re: Date Question
- Previous by thread: Re: Passing info to a report from a form
- Next by thread: Re: Passing info to a report from a form
- Index(es):
Relevant Pages
|