PC Review


Reply
Thread Tools Rate Thread

Blank Report

 
 
Alan
Guest
Posts: n/a
 
      6th Apr 2010
Sub PrintReports(ReportView As AcView)
' This procedure used in Preview_Click and Print_Click Sub procedures.
' Preview or print report selected in the ReportToPrint option group.
' Then close the Print Sales Reports Dialog form.
Dim strReportName As String
Dim strReportFilter As String
Dim lOrderCount As Long

' Determine report filtering
If Nz(Me.lstReportFilter) <> "" Then
strReportFilter = "([SalesGroupingField] = """ & Me.lstReportFilter
& """)"
End If

' Determine reporting time frame
Select Case Me.lstSalesPeriod
Case ByYear
strReportName = "Yearly Sales Report"
lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
Me.cbYear)
Case ByQuarter
strReportName = "Quarterly Sales Report"
lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
Me.cbYear & " AND [Quarter]=" & Me.cbQuarter)
Case ByMonth
strReportName = "Monthly Sales Report"
lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
Me.cbYear & " AND [Month]=" & Me.cbMonth)
End Select

If lOrderCount > 0 Then
TempVars.Add "Group By", Me.lstSalesReports.value
TempVars.Add "Display", DLookupStringWrapper("[Display]", "Sales
Reports", "[Group By]='" & Nz(Me.lstSalesReports) & "'")
TempVars.Add "Year", Me.cbYear.value
TempVars.Add "Quarter", Me.cbQuarter.value
TempVars.Add "Month", Me.cbMonth.value

eh.TryToCloseObject
DoCmd.OpenReport strReportName, ReportView, , strReportFilter,
acWindowNormal
Else
MsgBoxOKOnly NoSalesInPeriod
End If
End Sub

This code is for my print perview button, which link to yearly report which
is this code.

Option Compare Database

Option Explicit


Private Sub Report_Open(Cancel As Integer)
On Error GoTo ErrorHandler

Dim strSQL As String

If IsNull(TempVars![Display]) Or IsNull(TempVars![Group By]) Or
IsNull(TempVars![Year]) Then
DoCmd.OpenForm "Actual Report"
Cancel = True
Exit Sub
End If

strSQL = "TRANSFORM CCur(Nz(Sum([Amount]),0)) AS X"
strSQL = strSQL & " SELECT [" & TempVars![Display] & "] as
SalesGroupingField FROM [Sales Analysis] "
strSQL = strSQL & " Where [Year]=" & TempVars![Year]
strSQL = strSQL & " GROUP BY [" & TempVars![Group By] & "], [" &
TempVars![Display] & "]"
strSQL = strSQL & " Pivot [Sales Analysis].[Quarter] In (1,2,3,4)"

Me.RecordSource = strSQL
Me.SalesGroupingField_Label.Caption = TempVars![Display]

Done:
Exit Sub
ErrorHandler:
' Resume statement will be hit when debugging
If eh.LogError("Yearly Sales Report_Open", "strSQL = " & strSQL) Then
Resume
Else
Cancel = True
End If
End Sub

But everytime i run they report it does pick up any result the report is blank

can anyone tell me why?
 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      6th Apr 2010
What happens if you run the queries without the report? Do they return
records?
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"Alan" <(E-Mail Removed)> wrote in message
news:2C970FF8-5810-41EB-AFBD-(E-Mail Removed)...
> Sub PrintReports(ReportView As AcView)
> ' This procedure used in Preview_Click and Print_Click Sub procedures.
> ' Preview or print report selected in the ReportToPrint option group.
> ' Then close the Print Sales Reports Dialog form.
> Dim strReportName As String
> Dim strReportFilter As String
> Dim lOrderCount As Long
>
> ' Determine report filtering
> If Nz(Me.lstReportFilter) <> "" Then
> strReportFilter = "([SalesGroupingField] = """ & Me.lstReportFilter
> & """)"
> End If
>
> ' Determine reporting time frame
> Select Case Me.lstSalesPeriod
> Case ByYear
> strReportName = "Yearly Sales Report"
> lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
> Me.cbYear)
> Case ByQuarter
> strReportName = "Quarterly Sales Report"
> lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
> Me.cbYear & " AND [Quarter]=" & Me.cbQuarter)
> Case ByMonth
> strReportName = "Monthly Sales Report"
> lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
> Me.cbYear & " AND [Month]=" & Me.cbMonth)
> End Select
>
> If lOrderCount > 0 Then
> TempVars.Add "Group By", Me.lstSalesReports.value
> TempVars.Add "Display", DLookupStringWrapper("[Display]", "Sales
> Reports", "[Group By]='" & Nz(Me.lstSalesReports) & "'")
> TempVars.Add "Year", Me.cbYear.value
> TempVars.Add "Quarter", Me.cbQuarter.value
> TempVars.Add "Month", Me.cbMonth.value
>
> eh.TryToCloseObject
> DoCmd.OpenReport strReportName, ReportView, , strReportFilter,
> acWindowNormal
> Else
> MsgBoxOKOnly NoSalesInPeriod
> End If
> End Sub
>
> This code is for my print perview button, which link to yearly report
> which
> is this code.
>
> Option Compare Database
>
> Option Explicit
>
>
> Private Sub Report_Open(Cancel As Integer)
> On Error GoTo ErrorHandler
>
> Dim strSQL As String
>
> If IsNull(TempVars![Display]) Or IsNull(TempVars![Group By]) Or
> IsNull(TempVars![Year]) Then
> DoCmd.OpenForm "Actual Report"
> Cancel = True
> Exit Sub
> End If
>
> strSQL = "TRANSFORM CCur(Nz(Sum([Amount]),0)) AS X"
> strSQL = strSQL & " SELECT [" & TempVars![Display] & "] as
> SalesGroupingField FROM [Sales Analysis] "
> strSQL = strSQL & " Where [Year]=" & TempVars![Year]
> strSQL = strSQL & " GROUP BY [" & TempVars![Group By] & "], [" &
> TempVars![Display] & "]"
> strSQL = strSQL & " Pivot [Sales Analysis].[Quarter] In (1,2,3,4)"
>
> Me.RecordSource = strSQL
> Me.SalesGroupingField_Label.Caption = TempVars![Display]
>
> Done:
> Exit Sub
> ErrorHandler:
> ' Resume statement will be hit when debugging
> If eh.LogError("Yearly Sales Report_Open", "strSQL = " & strSQL) Then
> Resume
> Else
> Cancel = True
> End If
> End Sub
>
> But everytime i run they report it does pick up any result the report is
> blank
>
> can anyone tell me why?



 
Reply With Quote
 
Alan
Guest
Posts: n/a
 
      6th Apr 2010


Yer i solved this issue now, was bound to wrong column

You would know how i can select multi customer from my list box and then
place them into report using same code as below

"Arvin Meyer [MVP]" wrote:

> What happens if you run the queries without the report? Do they return
> records?
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.accessmvp.com
> http://www.mvps.org/access
>
>
> "Alan" <(E-Mail Removed)> wrote in message
> news:2C970FF8-5810-41EB-AFBD-(E-Mail Removed)...
> > Sub PrintReports(ReportView As AcView)
> > ' This procedure used in Preview_Click and Print_Click Sub procedures.
> > ' Preview or print report selected in the ReportToPrint option group.
> > ' Then close the Print Sales Reports Dialog form.
> > Dim strReportName As String
> > Dim strReportFilter As String
> > Dim lOrderCount As Long
> >
> > ' Determine report filtering
> > If Nz(Me.lstReportFilter) <> "" Then
> > strReportFilter = "([SalesGroupingField] = """ & Me.lstReportFilter
> > & """)"
> > End If
> >
> > ' Determine reporting time frame
> > Select Case Me.lstSalesPeriod
> > Case ByYear
> > strReportName = "Yearly Sales Report"
> > lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
> > Me.cbYear)
> > Case ByQuarter
> > strReportName = "Quarterly Sales Report"
> > lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
> > Me.cbYear & " AND [Quarter]=" & Me.cbQuarter)
> > Case ByMonth
> > strReportName = "Monthly Sales Report"
> > lOrderCount = DCountWrapper("*", "Sales Analysis", "[Year]=" &
> > Me.cbYear & " AND [Month]=" & Me.cbMonth)
> > End Select
> >
> > If lOrderCount > 0 Then
> > TempVars.Add "Group By", Me.lstSalesReports.value
> > TempVars.Add "Display", DLookupStringWrapper("[Display]", "Sales
> > Reports", "[Group By]='" & Nz(Me.lstSalesReports) & "'")
> > TempVars.Add "Year", Me.cbYear.value
> > TempVars.Add "Quarter", Me.cbQuarter.value
> > TempVars.Add "Month", Me.cbMonth.value
> >
> > eh.TryToCloseObject
> > DoCmd.OpenReport strReportName, ReportView, , strReportFilter,
> > acWindowNormal
> > Else
> > MsgBoxOKOnly NoSalesInPeriod
> > End If
> > End Sub
> >
> > This code is for my print perview button, which link to yearly report
> > which
> > is this code.
> >
> > Option Compare Database
> >
> > Option Explicit
> >
> >
> > Private Sub Report_Open(Cancel As Integer)
> > On Error GoTo ErrorHandler
> >
> > Dim strSQL As String
> >
> > If IsNull(TempVars![Display]) Or IsNull(TempVars![Group By]) Or
> > IsNull(TempVars![Year]) Then
> > DoCmd.OpenForm "Actual Report"
> > Cancel = True
> > Exit Sub
> > End If
> >
> > strSQL = "TRANSFORM CCur(Nz(Sum([Amount]),0)) AS X"
> > strSQL = strSQL & " SELECT [" & TempVars![Display] & "] as
> > SalesGroupingField FROM [Sales Analysis] "
> > strSQL = strSQL & " Where [Year]=" & TempVars![Year]
> > strSQL = strSQL & " GROUP BY [" & TempVars![Group By] & "], [" &
> > TempVars![Display] & "]"
> > strSQL = strSQL & " Pivot [Sales Analysis].[Quarter] In (1,2,3,4)"
> >
> > Me.RecordSource = strSQL
> > Me.SalesGroupingField_Label.Caption = TempVars![Display]
> >
> > Done:
> > Exit Sub
> > ErrorHandler:
> > ' Resume statement will be hit when debugging
> > If eh.LogError("Yearly Sales Report_Open", "strSQL = " & strSQL) Then
> > Resume
> > Else
> > Cancel = True
> > End If
> > End Sub
> >
> > But everytime i run they report it does pick up any result the report is
> > blank
> >
> > can anyone tell me why?

>
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If unbound list box in report is blank then don't show report deta Timmy Microsoft Access Reports 5 5th Nov 2008 08:47 PM
subreport in report footer has no data, showing blank page at the end of the report FA Microsoft Access Reports 1 16th May 2006 09:16 PM
View alternate report when first report is blank =?Utf-8?B?SnVidQ==?= Microsoft Access Reports 3 23rd Feb 2006 08:06 PM
when I close a form of a report the blank report opens =?Utf-8?B?VkdS?= Microsoft Access Reports 1 23rd Jan 2006 12:42 PM
blank line in a query for blank lines in a report Sandi Microsoft Access Queries 4 4th Jan 2006 08:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:47 AM.