Current location: Hot Scripts Forums » Programming Languages » Visual Basic » Changing Cloumna on a pivot table report in Access


Changing Cloumna on a pivot table report in Access

Reply
  #1 (permalink)  
Old 01-17-06, 09:53 AM
Beth1 Beth1 is offline
Newbie Coder
 
Join Date: Jan 2006
Location: West Greenwich, RI USA
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Changing Cloumna on a pivot table report in Access

Hi I need to change an Access based report. It is based on a crosstab query. Currently the columns on the report run Jan to Dec. I need to change that so they run based on startdate. The user enters the date parameters into the form and the query sends the information for that date frame to the report, but every time it prints out Jan to Dec.

If the users Start date is Aug I need the report to run Aug to Jul. Does anyone at this sight know how to code this type of report?

This is what I have so far but I am having error messages on the if Statement and I can not find the problem with the help feature.
Dim app As New Access.Application
Dim Rpt As Report
Dim ctl As Control
Dim strSQL As String
Dim db As Database
Dim qry As QueryDef
Set db = CurrentDb
Set qry = db.QueryDefs("qryincidentbymonth")

strSQL = "TRANSFORM Count(qryallstudy.STUDY_DETAIL_ID) AS CountOfSTUDY_DETAIL_ID SELECT qryallstudy.STUDY_DESC, Count(qryallstudy.STUDY_DETAIL_ID) AS [Total OfSTUDY_DETAIL_ID] FROM qryallstudy "
strSQL = strSQL & "WHERE (((qryallstudy.OCC_DATE) Between #" & Me.StartDate & "# And #" & Me.End_Date & "# )) "
strSQL = strSQL & "GROUP BY qryallstudy.STUDY_DESC PIVOT Format([OCC_DATE],""" & "mmm" & """) In (""" & "Jan" & """,""" & "Feb" & """,""" & "Mar" & """,""" & "Apr" & """,""" & "May" & """,""" & "Jun" & """,""" & "Jul" & """,""" & "Aug" & """,""" & "Sep" & """,""" & "Oct" & """,""" & "Nov" & """,""" & "Dec" & """));"

DoCmd.OpenReport "Incident by Month", acViewDesign

If Rpt.Name = "Incident by Month" Then
Select Case Format(Me.StartDate, "mm")
Case "01"
ctl.Properties.Item("Caption") = "JAN"
ctl.Properties.Item("Caption") = "FEB"
ctl.Properties.Item("Caption") = "MAR"
ctl.Properties.Item("Caption") = "APR"
ctl.Properties.Item("Caption") = "MAY"
ctl.Properties.Item("Caption") = "JUN"
ctl.Properties.Item("Caption") = "JUL"
ctl.Properties.Item("Caption") = "AUG"
ctl.Properties.Item("Caption") = "SEP"
ctl.Properties.Item("Caption") = "OCT"
ctl.Properties.Item("Caption") = "NOV"
ctl.Properties.Item("Caption") = "DEC"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-17-06, 02:20 PM
koncept
Guest
 
Posts: n/a
i do not use crosstabs directly (typicaly custom coded in asp...) but your where statement
Code:
WHERE (((qryallstudy.OCC_DATE) Between #" & Me.StartDate & "# And #" & Me.End_Date & "# )) "
should be limiting the results you are getting. Is that part working? if so then you just want to hide the coloumns from showing correct?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the Columns in a pivot table Beth1 Visual Basic 1 01-13-06 04:00 PM
Excel - Checking Access table for query and returning result lapsaj Visual Basic 7 11-26-04 12:19 PM
Changing a color on a table row one at a time. mtilori HTML/XHTML/XML 3 02-24-04 05:27 PM
changing table properties with ALTER TABLE Squid44th PHP 1 02-24-04 04:29 PM
VB and Access, adding new records to table mikecompsci Visual Basic 1 12-03-03 10:20 AM


All times are GMT -5. The time now is 10:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.