On Tue, 13 May 2008 02:17:04 +0000 (UTC), Analysis&Solutions wrote:
> Hi:
>
> I'm using the following Visual Basic code to open a re****t and set the
> value of an unbound text box in its page header. It works... but only
on
> pages other than the first one.
>
> DoCmd.OpenRe****t strRe****tName, acViewPreview, , strWhere
> Re****ts(strRe****tName)("SearchCriteriaBox").Value = strWhere
>
> How can I get it to work on the first page too, please? There are
other,
> regular text boxes in the page header that contain regular
> Control Sources in them, like =Now(), that are working fine. The
> re****t's Page Header setting is "All Pages," as it should be.
>
> Thanks,
>
> --Dan
There are several ways to do this.
Here is one.
On the form, open the re****t, set the criteria, and pass the criteria
to the re****t as the OpenArgs argument.
DoCmd.OpenRe****t strRe****tName, acViewPreview, , strWhere, , strWhere
In the re****t, assign the OpenArgs to the Page Header unbound control
in the Re****t's Re****t Header Format event (the Open event is too
early).
Code the re****t's Re****tHeader format event:
Me.[SearchCriteriaBox] = Me.OpenArgs
This will display your strWhere clause in the re****t page header, i.e.
[LastName] = 'Jones'
Is that what you want?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


|