Quantcast
Channel: VBForums - Reporting
Viewing all 589 articles
Browse latest View live

VB.Net 2015 ReportViewer change Server (Production Server)

$
0
0
I developed VB.Net 2010 application, with some Reports in Microsoft Report Viewer 2010. During programming time, we successfully created a DataSet and correctly use for Design a new Microsoft Report Viewer .rdlc, pointing to an SQL Server 2012 EXPRESS on local database in Developer Computer. Everything works fine. But when we try to deploy the .exe application in Production Environment, SQL SERVER 2012R2, pointing to de Production DATABASE. The Report Viewer still pointing to the Developer computer. Unsuccessfully tried some tricks from internet. Not working. Really appreciate some help.

RDLC Report now show all records

$
0
0
Hi,

I not even know how to ask.. Ill try.. I have rdlc report getting data from dataset with one-to-many parent and child records.

e.g. CarManufacturer---->CarMake----->Model

Now if I draw report it currently shows only records where ALL THREE items is present. But say in one of the records a 'model' is null then the whole record is not show in report.. This not what I want... I want to see if there empty fields too...

- Carmanufacturer will always have data
- Carmake can sometimes be null
- Model can sometimes be null

Can someone please help me?

Thanks,
M

RunTime Error 20535

$
0
0
Hi All,
i am in a real trouble. i have a application in vb6 and crystal report 8.5. when i am calling report so its showing a error "Incorrect session parameter". i am using a sub report at the header of main report. i determine that this error is happen because of it but i don't know how resolve is....


my current code is given below:

Code:

a = MsgBox("Do you want To Print Invoice?", vbYesNo + vbQuestion, CompanyName)
    If a = vbYes Then
        SelectQuery = "{GoldAssayMaster.ID}=" & Val(TxtID.Text)
        CR.SelectionFormula = SelectQuery
        CR.Connect = "PWD="Password"
        CR.ReportFileName = App.Path & "\Reports\GoldAssayReport.rpt"
        CR.Action = 1



Thanks in advance experts.

[RESOLVED] RunTime Error 20535

$
0
0
Hi All,
i am in a real trouble. i have a application in vb6 and crystal report 8.5. when i am calling report so its showing a error "Incorrect session parameter". i am using a sub report at the header of main report. i determine that this error is happen because of it but i don't know how resolve is....


my current code is given below:

Code:

a = MsgBox("Do you want To Print Invoice?", vbYesNo + vbQuestion, CompanyName)
    If a = vbYes Then
        SelectQuery = "{GoldAssayMaster.ID}=" & Val(TxtID.Text)
        CR.SelectionFormula = SelectQuery
        CR.Connect = "PWD="Password"
        CR.ReportFileName = App.Path & "\Reports\GoldAssayReport.rpt"
        CR.Action = 1



Thanks in advance experts.

Subreport connection Error

$
0
0
Hi All,
I have a report which have 3 subreports. when i call report from vb6 its running properly and after that when i close report and run again without closing the form so its giving me error "Field name is not known." . i am trying so many things but its still showing error.

can anyone tell me where i am wrong??


Thanks in advance.

Cheers.

Having a hard time with Crystal Report Crosstabs... I need it to display string value

$
0
0
Supplier 1/ Status: (string)
Item 1: Unit Price, Total Price
Item 2: Unit Price, Total Price


Supplier 2/ Status: (string)
Item 1: Unit Price, Total Price
Item 2: Unit Price, Total Price


Supplier 3/ Status: (string)
Item 1: Unit Price, Total Price
Item 2: Unit Price, Total Price


That was basically the contents of my table, and I want it to display horizontally (the suppliers as main column; unit price, total price as sub-columns, then Status of the Supplier as an additional column after) crossed with the items on the side as rows. While the Crystal Reports can display numericals and I can suppress the price total and grand totals since it was unneeded, I am having a hard time to display the status. I've seen suggestions on the web like GridRowColumnValue(row or column name, index) here or here but it wasn't really clear to me how could I apply such code to my problem/

Winforms RDLC Report - Details not showing

$
0
0
I have a problem in my RDLC Report. The report header is displaying whilst the report details are not.

Report Layout:

Name:  1.jpg
Views: 12
Size:  6.1 KB

Report Output:

Name:  2.jpg
Views: 11
Size:  9.3 KB

As you can see I've already called the SQL fields in the report layout and the report output does not display any data.

I use 2 forms: Form 1 is the generation of data whilst Form 2 is the Report Viewer.

This is a part of my code in Form 1 (Generation of Data):

Code:

Private Sub btnGenerate_Click(sender As Object, e As EventArgs) Handles btnGenerate.Click

    Dim rprtName As String

    If lstReports.SelectedIndex = 0 Then
        rprtName = "rprtIS"
    Else
        rprtName = ""
    End If

    Dim frmrpt As New frmReportViewer

    frmrpt.ismo = cbMonth.Text
    frmrpt.isye = cbYear.Text
    frmrpt.strReport = rprtName

    frmrpt.ShowDialog()

End Sub

This is the sample code for the Report Viewer form:

Code:

Private Sub frmReportViewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Dim rprtDataSource As ReportDataSource

    Try
        With Me.rprtViewer.LocalReport
            .Refresh()
            .ReportEmbeddedResource = "REPORTTESTING1." + strReport + ".rdlc"
        End With

        Select Case strReport
            Case "rprtIS"
                Dim ds As New REPORTTESTING1.ds_spIS
                Dim da As New REPORTTESTING1.ds_spISTableAdapters.SP_Select_Invoice_SummaryTableAdapter

                ds.Clear()

                rprtDataSource = New ReportDataSource("dsIS", ds.Tables("SP_Select_Invoice_Summary"))
                Me.rprtViewer.LocalReport.DataSources.Add(rprtDataSource)
                da.Fill(ds.SP_Select_Invoice_Summary, ismo, isye)

        End Select

        Me.rprtViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.Normal)

    Catch ex As Exception
        MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try

End Sub

Thanks in advance,
Attached Images
  

Printing a report without preview not working in Windows10

$
0
0
I have been using 'Printing a report without preview' as described below:

https://msdn.microsoft.com/en-us/library/ms252091.aspx

I now find with Windows10 it is not working - It is not displaying the font correctly.

It now only works on the Windows 7 computers. Print using the preview works on all computers.

The printer is an old Label printer and it doesn't have Windows10 drivers. But I can print OK if I use the normal print preview.

Any ideas what is going wrong?

How to set background to image without touch qr code

$
0
0
Problem

Image conflict and interact with qr code and when read it not read because color and text

affect on qr

generation

I work in vs 2015 windows form application with c#

I using microsoft report with report viewer to display report as below

so that how to set background image without doing damamge in qr ?

qr show in image control

my problem is when set background to image or water mark it cover all page or space

so that what i do to prevent damage qr ?

marksheet using crysal reports

$
0
0
Hi .Please help me solve this problem.
I need to design a marksheet using crystal reports in this format:

Name:  marksheet.jpg
Views: 252
Size:  20.7 KB




I have a table called Subjects that store details about each subject:

Name:  subjects.jpg
Views: 249
Size:  21.9 KB



As is evident from the table and the marksheet, the profile of subjects is varied.
For eg: the subject G-102 has both Theory and Practical component. Theory component has one type of grade ie End Term Grade while Practical component has only one grade type Progressive Assessment.

On the other hand subject G-102 has End Term and Progressive grades for Theory component whereas Practical has only End Term grade. Likewise other subjects have their own profiles.

I have a Gradetype table:
Name:  grade.png
Views: 247
Size:  9.7 KB




and I have Subjects_Gradetype_junction table

Name:  subject_grade_junction.png
Views: 250
Size:  19.4 KB




There is a Departments table:
[department_id]
[department_name]

For eg:
Computer Science Dept has id 14
Civil Engineering has id 15


And there is the Departments_subjects_table with two foreign keys:
department_id and subject_id



Finally, there is the Student_Subjects_junction where I actually store the marks:

Name:  Students_Subjects_junction.png
Views: 246
Size:  23.1 KB





I need allow the user to generate marksheets after he chooses semester and department from the combo boxes in the form.
I cannot solve it because the marksheet design is itself not static. It will change according to the Semester and Department. Foe example: Semester I of Computer Science Department will have five subjects whereas Semester V of Computer Science Department will have 6 subjects. And to make matters more complicated each subject profile will vary as i have said before.

Please help me. Thanks
Attached Images
     

Crystal report Issue

$
0
0
Hello, And thanks in advance for your assistance

i have an issue with crystal report, for example i have a report that prints out this way:

Name:  1.png
Views: 55
Size:  3.5 KB


the data are coming a from a join query with distinct selection record, so far i was able to get this report by suppressing duplicate values ;

Name:  2.png
Views: 43
Size:  5.4 KB

i'm wondering if there s any way i can get the report to show this way

Name:  3.png
Views: 45
Size:  3.9 KB

thanks for you help
Attached Images
   

crystal report issue-C#

$
0
0
Hello, And thanks in advance for your assistance

i have an issue with crystal report, for example i have a report that prints out this way:

Name:  1.png
Views: 59
Size:  3.5 KB


the data are coming a from a join query with distinct selection record, so far i was able to get this report by suppressing duplicate values ;

Name:  2.png
Views: 52
Size:  5.4 KB

i'm wondering if there s any way i can get the report to show this way

Name:  3.png
Views: 52
Size:  3.9 KB

thanks for your help
Attached Images
   

Crystal report local variable

$
0
0
I have a table with 4 columns (Morning/Afternoon/Evening/Night)char(1) field data will Y/N in the column

with this table i am creating a crystal report
the output should be something like this

if Morning and night is Y

Mor.........Night (nine dots)

If only Morning is Y
Mor ( not dots)

If Afternoon and Evening
...Afternoon...Evening

if Morning and Evening
Mor......Evening(6 dots between mor and ever )

if Morning Afternoon evening and night is Y
Mor...After...Eve...Night

like this i want in crystal report
I tried like this but not working properly
in cystal report formula editor

local stringvar flag;
if {Table.Morning}='Y' then
flag:='Mor'
else
flag:='...'

if {Table.Afternoon}='Y' then
flag:=Flag+'after'
else
flag:=flag;

but is not as per desire

print without preview the crystal report

$
0
0
Hi,

I am trying to send my crystal report directly to a printer without preview. Some how my code is not working. Any help? Thanks.

Here is the code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ds As New System.Data.DataSet
Dim objDataLink As New HSC_College.DataLink
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rpt.Load(Server.MapPath("reports\" & Request.QueryString("ReportID") & ".rpt"))

If Request.QueryString("ReportID") = "Clinical_Competency" Then
If Not Request.QueryString("EvaluationID") Is Nothing Then
If Request.QueryString("EvaluationID").ToString.Length > 0 Then
Session("EvaluationID") = Request.QueryString("EvaluationID")
End If
End If
Dim intEvaluationID As Integer = Session("EvaluationID")
ds = objDataLink.spMED_GEN_ReportClinComp(intEvaluationID)
rpt.Database.Tables(0).SetDataSource(ds.Tables(0))
rpt.PrintToPrinter(1, False, 0, 0)
End If
End Sub

Crystal Report - Export, Preview, Print options

$
0
0
If you've read my other recent posts, you know I am converting a VB6 app to .NET. The app has a dialog for Crystal Reports where the user can choose a printer and the OK button prints, and the Export button goes to Excel (I think...intuitively one would think so), and there's a Cancel and Preview button. The form looks like this:
Name:  Select Report Destination.JPG
Views: 90
Size:  29.0 KB

I figured some of that was built into .NET and I wouldn't have to port it exactly from VB6, but a PrintDialog and PrintDocument control gave me this at runtime:
Name:  Select Report Destination .NET.JPG
Views: 102
Size:  39.1 KB

That is too much. I really only want the part I highlighted, Select Printer. And I want different buttons. This doesn't look like something I can customize based on the properties that are available. Is there something else I can use to just give me the Select Printer part? Should I just port the VB6 code? (Even though I am not sure how to get the printers because VB6 seems to magically have this object called "Printers" that it loads into the combobox).

Thanks.
Attached Images
  

Crystal Report - two databases

$
0
0
Hello. I have a report that wants to run a query against three tables. Jobs and xtblProjects are in database A and p21_view_customer is in database B. The report file has already been written and if I preview it in Visual Studio it's fine. My problem is when I run my C# application. I was getting "The table 'p21_view_customer' could not be found." I fixed that, and now my report is blank :/.

These are the things I've been trying. I have a routine called SetupForTheReport() that is called to loop through the report tables and set the logon info. The logon info was always database A and then I hit this report that also wanted to use database B. So I thought this logic would help:
Code:

        private void SetupForTheReport(string filenameOfReport)
        {
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            crConnectionInfo.ServerName = "nn.nn.nn.nn";
            crConnectionInfo.DatabaseName = "Database A";
            crConnectionInfo.IntegratedSecurity = true;

            crReport = new ReportDocument();
            crReport.Load(filenameOfReport);

            Tables crTables;
            TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
            crTables = crReport.Database.Tables;
            foreach (Table crTable in crTables)
            {
                if (crTable.Name == "p21_view_customer")
                {
                    ConnectionInfo crConnectionInfoP21 = new ConnectionInfo();
                    crConnectionInfoP21.ServerName = "nn.nn.nn.nn"; // It's the same server as above
                    crConnectionInfoP21.DatabaseName = "Database B";
                    crConnectionInfoP21.IntegratedSecurity = true;

                    crTableLogonInfo = crTable.LogOnInfo;
                    crTableLogonInfo.ConnectionInfo = crConnectionInfoP21;
                    crTable.ApplyLogOnInfo(crTableLogonInfo);

                    crConnectionInfoP21 = null;
                }
                else
                {
                    crTableLogonInfo = crTable.LogOnInfo;
                    crTableLogonInfo.ConnectionInfo = crConnectionInfo;
                    crTable.ApplyLogOnInfo(crTableLogonInfo);
                }
            }
        }

But no, same error that the table couldn't be found.

Then in Visual Studio, I started scrutinizing the report and in Field Explorer under Database Fields the three tables are listed. They were all pointing to Database A. Now it does look like p21_view_customer is correctly saying Catalog: Database B. But still, table couldn't be found. (This didn't make sense to me because the preview worked in Visual Studio and how could it have if the Catalog of the Database B table was pointing to Database A?)

Then I found a tutorial on YouTube and I changed datasources...it really seemed like I was just redoing things I'd already done, but a new sql query was generated. It has two parts. Part 1 selects from Jobs and xtblProjects in A and the second part selects from p21_view_customer in B. And it looks like they get connected by "EXTERNAL JOIN", and that is giving me the blank report. I don't know if this is progress because it found the table finally and I just have debug why it's blank?

So my question is, isn't there a straightforward way to run a query against tables in 2 databases that are on the same server?

just need help on this...

$
0
0
Public Sub PopulateFormulas(thisSheet As Worksheet)
Dim lastRow As Long

lastRow = thisSheet.UsedRange.Rows.Count
thisSheet.UsedRange.Cells(2, "T").FormulaR1C1 = "=VLOOKUP(RC[-10],roster!C[-19]:C[-16],4,0)"
thisSheet.UsedRange.Cells(2, "U").FormulaR1C1 = "=VLOOKUP(RC[-2],roster!C[-19]:C[-17],5,0)"
thisSheet.UsedRange.Cells(2, "V").FormulaR1C1 = "=IF(RC[-8]=R1C,""1"",""0"")"
thisSheet.UsedRange.Cells(2, "W").FormulaR1C1 = "=IF(RC[-9]=R1C,""1"",""0"")"
thisSheet.UsedRange.Cells(2, "X").FormulaR1C1 = "=IF(RC[-10]=R1C,""1"",""0"")"
thisSheet.UsedRange.Cells(2, "Y").FormulaR1C1 = "=IF(RC[-11]=R1C,"".25"",""0"")"
thisSheet.UsedRange.Cells(2, "Z").FormulaR1C1 = "=IF(RC[-11]=R1C,"".25"",""0"")"
thisSheet.UsedRange.Cells(2, "AA").FormulaR1C1 = "=IF(RC[-13]=R1C,"".25"",""0"")"
thisSheet.UsedRange.Cells(2, "AB").FormulaR1C1 = "=SUM(RC[-6]:RC[-1])"
'need help on this.
thisSheet.UsedRange.Cells.EntireRow.AutoFill Destination:=Range("t2:AA2"), Type:=xlFillDefault
thisSheet.Range("V2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
thisSheet.Range.Cells(2, "T").NumberFormat = "0.00"

trying my luck here

$
0
0
Can anyone help me on my code below to simplify... im not a programmer but i just tried to google everything and record some steps. But if you could help me simply the code below would be very much appreciated.

Sub generate()

Dim timeStart As Date, timeEnd As Date, dateDate As Date, dS As Date, dE As Date
Dim lastRow As Long, erow As Integer, sheet1 As Worksheet, sheet2 As Worksheet
Dim PSheet As Worksheet
Dim DSheet As Worksheet
Dim PCache As PivotCache
Dim PTable As PivotTable
Dim PRange As Range
Dim LastCol As Long
Dim Firstrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
Dim i As Long
Dim r As Long, lr As Long
Dim intA As Integer
Dim wrksht As Excel.Worksheet
Dim Aname As String
timeStart = Now()


Sheets("Episodes").Select
Sheets("target").Visible = True
Sheets("Episodes").Select
Sheets("roster").Visible = True

Set wrksht = Application.Worksheets("source")
intA = 1

Do Until intA = wrksht.UsedRange.Rows.Count

Select Case wrksht.Cells(intA, "O").Value
Case "OPEN", "OPEN - New", "OPEN-MD Review", "OPEN-PENDING", "OPEN-PENDING ACTIVITY", "OPEN-Transfer", "CLOSED BY ONSHORE", "VOID - INVALID-Rework"
wrksht.Rows(intA).Delete

Case Else
intA = intA + 1

End Select

Loop


Sheets("target").Select
Cells.Select
Selection.ClearContents

Set sheet1 = Worksheets("source")
Set sheet2 = Worksheets("target")
lastRow = sheet1.Cells(Rows.Count, 1).End(xlUp).Row

For i = 1 To lastRow
erow = sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 1).Row
sheet2.Cells(erow, 1) = sheet1.Cells(i, 1) 'Episode_Number
sheet2.Cells(erow, 2) = sheet1.Cells(i, 2) 'SR_Number
sheet2.Cells(erow, 3) = sheet1.Cells(i, 4) 'CTS_DueDate
sheet2.Cells(erow, 4) = sheet1.Cells(i, 6) 'Request_Received_Date
sheet2.Cells(erow, 5) = sheet1.Cells(i, 7) 'FB_Age
sheet2.Cells(erow, 6) = sheet1.Cells(i, 8) 'Group_Name
sheet2.Cells(erow, 7) = sheet1.Cells(i, 9) 'Reason for Referral
sheet2.Cells(erow, 8) = sheet1.Cells(i, 11) 'Client Group
sheet2.Cells(erow, 9) = sheet1.Cells(i, 12) 'DueDate_Day
sheet2.Cells(erow, 10) = sheet1.Cells(i, 13) 'Allocated To
sheet2.Cells(erow, 11) = sheet1.Cells(i, 14) 'Allocated Date
sheet2.Cells(erow, 12) = sheet1.Cells(i, 15) 'Status
sheet2.Cells(erow, 13) = sheet1.Cells(i, 16) 'GBK Code
sheet2.Cells(erow, 14) = sheet1.Cells(i, 18) 'Last Updated Date
sheet2.Cells(erow, 15) = sheet1.Cells(i, 19) 'Uploaded Date

Next i

Columns("K:K").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("J:J").Select
Selection.TextToColumns Destination:=Range("J1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(9, 1)), TrailingMinusNumbers:=True
'Columns("K:K").Select

Columns("J:J").Select
Selection.Replace What:="-", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

'-----
' inserts a new column and delimit
Columns("M:M").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("L:L").Select
Selection.TextToColumns Destination:=Range("L1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(11, 1)), TrailingMinusNumbers:=True

' converts to date
Columns("L:L").Select
Selection.TextToColumns Destination:=Range("L1"), DataType:=xlDelimited, _
TextQualifier:=xlSingleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:=",", FieldInfo:=Array(1, 3), TrailingMinusNumbers:=True

Columns("Q:Q").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("P:P").Select
Selection.TextToColumns Destination:=Range("P1"), DataType:=xlFixedWidth, _
OtherChar:=",", FieldInfo:=Array(Array(0, 1), Array(12, 1)), _
TrailingMinusNumbers:=True
Selection.TextToColumns Destination:=Range("P1"), DataType:=xlDelimited, _
TextQualifier:=xlSingleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:=",", FieldInfo:=Array(1, 3), TrailingMinusNumbers:=True

Columns("R:R").Select
Selection.TextToColumns Destination:=Range("R1"), DataType:=xlFixedWidth, _
OtherChar:=",", FieldInfo:=Array(Array(0, 1), Array(12, 1)), _
TrailingMinusNumbers:=True
Selection.TextToColumns Destination:=Range("R1"), DataType:=xlDelimited, _
TextQualifier:=xlSingleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, OtherChar _
:=",", FieldInfo:=Array(1, 3), TrailingMinusNumbers:=True
'
' '-------------------stop here
'add headers
Range("A1").Select
ActiveCell.FormulaR1C1 = "Episode Number"
Range("B1").Select
ActiveCell.FormulaR1C1 = "SR Number"
Range("C1").Select
ActiveCell.FormulaR1C1 = "CTS Due Date"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Request Received Data"
Range("E1").Select
ActiveCell.FormulaR1C1 = "FB Age"
Range("F1").Select
ActiveCell.FormulaR1C1 = "Group Name"
Range("G1").Select
ActiveCell.FormulaR1C1 = "Reason for Referral"
Range("H1").Select
ActiveCell.FormulaR1C1 = "Client Group"
Range("I1").Select
ActiveCell.FormulaR1C1 = "Due Date Day"
Range("J1").Select
ActiveCell.FormulaR1C1 = "Associate ID"
Range("K1").Select
ActiveCell.FormulaR1C1 = "Associates Name"
Range("L1").Select
ActiveCell.FormulaR1C1 = "Allocated Date"
Range("M1").Select
ActiveCell.FormulaR1C1 = "Aloocated Time"
Range("N1").Select
ActiveCell.FormulaR1C1 = "Status"
Range("O1").Select
ActiveCell.FormulaR1C1 = "GBK Code"
Range("P1").Select
ActiveCell.FormulaR1C1 = "Last Updated Date"
Range("Q1").Select
ActiveCell.FormulaR1C1 = "Total Work"
Range("R1").Select
ActiveCell.FormulaR1C1 = "Uploaded Date"
Range("S1").Select
ActiveCell.FormulaR1C1 = "Uploaded Time"
Range("T1").Select
ActiveCell.FormulaR1C1 = "Project Manager"
Range("U1").Select
ActiveCell.FormulaR1C1 = "Ops Manager"
Range("V1").Select
ActiveCell.FormulaR1C1 = "CLOSED-Overturned"
Range("W1").Select
ActiveCell.FormulaR1C1 = "CLOSED-Upheld"
Range("X1").Select
ActiveCell.FormulaR1C1 = "CLOSED-MD Approved"
Range("Y1").Select
ActiveCell.FormulaR1C1 = "VOID-Duplicate"
Range("Z1").Select
ActiveCell.FormulaR1C1 = "VOID-Already Paid"
Range("AA1").Select
ActiveCell.FormulaR1C1 = "VOID-Misroute"
Range("AB1").Select
ActiveCell.FormulaR1C1 = "Productivity"
'---- deletes the row 2 header
Rows("2:2").Select
Selection.Delete Shift:=xlUp
'
' '----- stops here for vlookup associates and project manager
Range("T2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-10],roster!C[-19]:C[-16],4,0)"
Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T30000")
Range("T2:T30000").Select
Range("V4").Select
'---- vlookup completed
'--- paste values

'computation here ---
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.NumberFormat = "0.00"
Range("V2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-8]=R1C,""1"",""0"")"
Range("W2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-9]=R1C,""1"",""0"")"
Range("X2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-10]=R1C,""1"",""0"")"
Range("Y2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-11]=R1C,"".25"",""0"")"
Range("Z2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-12]=R1C,"".25"",""0"")"
Range("AA2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-13]=R1C,"".25"",""0"")"
Range("AB2").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-6]:RC[-1])"
Selection.NumberFormat = "0.00"


'autofill to down
Range("V2:AB2").Select
Selection.AutoFill Destination:=Range("V2:AB15000")
Selection.NumberFormat = "0.00"
Range("V2:AB15000").Select


Range("V2:AA2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Application.CutCopyMode = False
Selection.Copy
Application.CutCopyMode = False
Selection.Copy
Range("V2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Dim LastRow As Integer, erow As Integer, sheet1 As Worksheet, sheet2 As Worksheet
'Delete Preivous Pivot Table Worksheet & Insert a New Blank Worksheet With Same Name
On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Episodes").Delete
Sheets.Add Before:=ActiveSheet
ActiveSheet.Name = "Episodes"
Application.DisplayAlerts = True
Set PSheet = Worksheets("Episodes")
Set DSheet = Worksheets("target")
'
'
'Define Data Range
lastRow = DSheet.Cells(Rows.Count, 1).End(xlUp).Row
LastCol = DSheet.Cells(1, Columns.Count).End(xlToLeft).Column
Set PRange = DSheet.Cells(1, 1).Resize(lastRow, LastCol)

'Define Pivot Cache
Set PCache = ActiveWorkbook.PivotCaches.Create _
(SourceType:=xlDatabase, SourceData:=PRange). _
CreatePivotTable(TableDestination:=PSheet.Cells(2, 2), _
TableName:="Episodes")


'Insert Blank Pivot Table
Set PTable = PCache.CreatePivotTable_
'(TableDestination:=PSheet.Cells(1, 1), TableName:="SalesPivotTable")

'Insert Row Fields -------------------------------------------

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"target!R1C1:R18000C21", Version:=xlPivotTableVersion15).CreatePivotTable _
TableDestination:="Episodes!R3C1", TableName:="Episodes", DefaultVersion _
:=xlPivotTableVersion15
Sheets("Episodes").Select
Cells(3, 1).Select


With ActiveSheet.PivotTables("Episodes").PivotFields("Project Manager")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("Episodes").PivotFields("Associates Name")
.Orientation = xlRowField
.Position = 2
End With
ActiveSheet.PivotTables("Episodes").AddDataField ActiveSheet.PivotTables( _
"Episodes").PivotFields("Total Work"), "Count of Total Work", xlCount
'\\\\\
' With ActiveSheet.PivotTables("Episodes").PivotFields("Sum of Total Work")
' .Caption = "Count of Total Work"
' .Function = xlCount
' End With
'\\\\
With ActiveSheet.PivotTables("Episodes").PivotFields("Sum of Total Work")
.Caption = "Count of Total Work"
.Function = xlCount
End With


ActiveSheet.PivotTables("Episodes").AddDataField ActiveSheet.PivotTables( _
"Episodes").PivotFields("Productivity"), "Count of Productivity", xlCount
With ActiveSheet.PivotTables("Episodes").PivotFields("Count of Productivity")
.Caption = "'Productivity"
.Function = xlSum
End With

With ActiveSheet.PivotTables("Episodes").PivotFields("Status")
.Orientation = xlRowField
.Position = 3
End With
With ActiveSheet.PivotTables("Episodes").PivotFields("Last Updated Date")
.Orientation = xlColumnField
.Position = 1
End With

With ActiveSheet.PivotTables("Episodes").PivotFields("Client Group")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("Episodes").PivotFields("FB Age")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("Episodes").PivotFields("Group Name")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("Episodes").PivotFields("Reason for Referral")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("Episodes").PivotFields("GBK Code")
.Orientation = xlPageField
.Position = 1
End With
Range("B3").Select
ActiveSheet.PivotTables("Episodes").CompactLayoutRowHeader = "Associates Name"
Range("C3").Select
ActiveSheet.PivotTables("Episodes").TableStyle2 = "PivotStyleDark7"
Cells.Select



With Selection.Font
.Name = "Calibri"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With

ActiveWindow.DisplayGridlines = False
Range("A4").Select
ActiveSheet.PivotTables("Episodes").CompactLayoutRowHeader = _
"Associates Name"
Range("C3").Select

ActiveWorkbook.ShowPivotTableFieldList = False
Range("F5").Select
ActiveWindow.FreezePanes = True
ActiveWindow.Zoom = 85
Cells.Select


Sheets("source").Select
Application.CutCopyMode = False
Selection.ClearContents
Sheets("Episodes").Select
Cells.EntireColumn.AutoFit

Sheets("target").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("roster").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("source").Select
ActiveWindow.SelectedSheets.Visible = False
'create a workbook
Episodes = ActiveWorkbook.Sheets(1).Range("A1").Value
Workbooks.Add
ActiveWorkbook.SaveAs Filename:=Episodes & ".xls"


timeEnd = Now()
MsgBox ("Completed in " & Format(timeEnd - timeStart, "hh:mm:ss") & ".")


End Sub

vb6 and crystal report question

$
0
0
I am not sure if this question should be in here cause it involves vb6 code and crystal report or sql query.

I have this record for example group of subjects and grade per student. I will print this record on half paper. I would like to appear each subject with corresponding grades separately in each half size paper. so like math and algebra would be shown on one paper since they belong to same group and english on another paper and so on.

I have group id assigned to each subject.

Its like, they are page 1, its the math and algebra then page 2 its english and so on.

How will i do that?

Invalid parameter name

$
0
0
Good Day!

I need your help guys, I'm having a problem calling my report using parameters.
I got this error.

Name:  untitled.JPG
Views: 69
Size:  18.0 KB


I'm trying to print a report that filters the date selected by the user.

Code:

  Dim SelectionFormula As String

    With CrystalReport1

          .Reset
          .Connect = "MyConnection"
 
          .ReportFileName = App.Path & "\Reports\RESIGNEDperBenefits.rpt"
         
          .LogOnServer "pdsodbc.dll", "Connection", GlobalConnDatabase, GlobalConnUsername, GlobalConnPassword
          .RetrieveDataFiles
          .WindowShowCloseBtn = True
          .WindowShowExportBtn = True
          .WindowShowRefreshBtn = True
          .WindowShowPrintBtn = True
          .WindowShowPrintSetupBtn = True
          .WindowState = crptMaximized
         
            .ParameterFields(0) = "Type;" & Text1.Text & ";TRUE"
            .StoredProcParam(1) = DTPicker1.Value
     
            .Action = 1
  End With



I used the Stored Procedure connected with my report.

Code:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go



ALTER PROCEDURE [dbo].[COEResigned]
@dt1 as datetime,
@dt2 as datetime
AS
BEGIN
select * from dbo.view_COEResigned
where dateresigned between @dt1 and @dt2
        SET NOCOUNT ON;

END


Please help me//
Attached Images
 
Viewing all 589 articles
Browse latest View live




Latest Images