Bob Gajewski
rbgajewski at adelphia.net
Fri Aug 10 05:12:49 CDT 2007
A.D. That worked perfectly! Many thanks, Bob Gajewski -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D.TEJPAL Sent: Monday, August 06, 2007 14:55 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Problem with A2003 Report caption Bob, You can try passing the caption string as report's OpenArgs as follows: DoCmd.OpenReport strReportName, _ acViewPreview, , strWhere, , strReportCaption Code in report's open event would be: Private Sub Report_Open(Cancel As Integer) Me.Caption = Me.OpenArgs End Sub Best wishes, A.D.Tejpal --------------- ----- Original Message ----- From: Bob Gajewski To: 'Access Developers discussion and problem solving' Sent: Monday, August 06, 2007 11:06 Subject: [AccessD] Problem with A2003 Report caption Hi Folks I am running into a problem with a new report. I am using a form to select record types and a date range, and passing the parameters to the report. Everything is working perfectly and as expected *EXCEPT* that my report caption does not print on the first page. It's there from Page 2 through the end, regardless of how many pages. My form code sample is below. I have confirmed that the value of "frmDateRange" just prior to the OpenReport is "1". On the actual report, the unbound text field for the report title has a control source of "=[Caption]". If anyone has any ideas on how to fix this, or can at least point me in the right direction, I will be truly grateful. Thanks ! Bob Gajewski CODE SAMPLE (frmMembersResponses) ================================= Private Sub cmdGenerateReport_Click() On Error GoTo Err_cmdGenerateReport_Click Dim strReportName As String, strWhere As String strReportName = "rptMembersResponse" strWhere = "" ' Set strWhere for Date Range If Not IsNull(Me!dteDateRangeSelectFrom) Or Me!dteDateRangeSelectFrom <> "" Then If IsNull(strWhere) Or strWhere = "" Then strWhere = "([IncidentDate] >= #" & Me!dteDateRangeSelectFrom & "#)" Else strWhere = "(" & strWhere & ") And ([IncidentDate] >= #" & Me!dteDateRangeSelectFrom & "#)" End If End If If Not IsNull(Me!dteDateRangeSelectTo) Or Me!dteDateRangeSelectTo <> "" Then If IsNull(strWhere) Or strWhere = "" Then strWhere = "([IncidentDate] <= #" & Me!dteDateRangeSelectTo & "#)" Else strWhere = "(" & strWhere & ") And ([IncidentDate] <= #" & Me!dteDateRangeSelectTo & "#)" End If End If ' Print report Dim rpt As Report, strReportCaption As String If IsNull(strWhere) Or strWhere = "" Then Select Case frmDateRange Case 1 strReportCaption = "Member Responses for Call Year " & Format([dteDateRangeSelectFrom], "MM/DD/YYYY") & " - " & Format([dteDateRangeSelectTo], "MM/DD/YYYY") Case 2 strReportCaption = "Member Responses for Calendar Year " & DatePart("yyyy", [dteDateRangeSelectFrom]) Case 3 strReportCaption = "Member Responses for " & Format([dteDateRangeSelectFrom], "MM/DD/YYYY") & " - " & Format([dteDateRangeSelectTo], "MM/DD/YYYY") Case Else strReportCaption = "Member Responses" End Select Else Select Case frmDateRange Case 1 strReportCaption = "Selected Member Responses for Call Year " & Format([dteDateRangeSelectFrom], "MM/DD/YYYY") & " - " & Format([dteDateRangeSelectTo], "MM/DD/YYYY") Case 2 strReportCaption = "Selected Member Responses for Calendar Year " & DatePart("yyyy", [dteDateRangeSelectFrom]) Case 3 strReportCaption = "Selected Member Responses for " & Format([dteDateRangeSelectFrom], "MM/DD/YYYY") & " - " & Format([dteDateRangeSelectTo], "MM/DD/YYYY") Case Else strReportCaption = "Selected Member Responses" End Select End If MsgBox ("The value of 'strReportCaption' is " & strReportCaption & ".") DoCmd.OpenReport strReportName, acViewPreview, , strWhere Set rpt = Reports(strReportName) rpt.OrderByOn = True rpt.OrderBy = strSortOrder rpt.Caption = strReportCaption -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.11.6/938 - Release Date: 08/05/2007 16:16 PM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.11.11/944 - Release Date: 08/09/2007 14:44 PM