I think this is the fastest and seems to be working:
DoCmd.OpenReport "TrainingPlanBranch", acViewPreview, Replace(Reports!TrainingPlanBranch.RecordSource, "Nogales", strWho)
Liz Ravenwood
Programmer/Analyst
Super First Class Products
B/E Aerospace
O: 1.520.239.4808
www.beaerospace.com
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Liz Ravenwood
Sent: Wednesday, October 24, 2012 10:29 AM
To: 'MS_Access_Professionals@yahoogroups.com'
Subject: [MS_AccessPros] recordsource not filter on report preview event
Pros, I have two complete sets of data which mirror each other for different sites. I only want to maintain one set of forms and reports and the forms on open and dynamic setting of the recordsource is working for me. I figured I could do the same thing for the reports... have the on open set the recordsource to something on open for preview before someone sends it off to the printer, but it's not working - saying I can't do it in preview.
I have a procedure:
Public Sub SetRecordSource(obj As Object)
obj.RecordSource = Replace(obj.RecordSource, "Nogales", strWho)
obj.lblSite.Caption = strWho
obj.Caption = Replace(obj.Caption, "Nogales", strWho)
Dim ctl As Control
For Each ctl In obj.Controls
If ctl.ControlType = acComboBox Or ctl.ControlType = acListBox Then
ctl.RowSource = Replace(ctl.RowSource, "Nogales", strWho)
End If
Next
End Sub
And the report on open event:
Private Sub Report_Open(Cancel As Integer)
Call SetRecordSource(Me)
End Sub
I LOVE how the forms are working, and want the same luxury with the reports. Any ideas or suggestions?
Liz Ravenwood
Programmer/Analyst
Super First Class Products
B/E Aerospace
O: 1.520.239.4808
www.beaerospace.com<http://www.beaerospace.com>
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar