Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Passing Parameters to Crystal Report at Runtime

Passing Parameters to Crystal Report at Runtime

Scheduled Pinned Locked Moved Visual Basic
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saneng
    wrote on last edited by
    #1

    Hello I have to pass parameters to crystal report at runtime,i have already created reports in crystal report 9,below is my code Dim reportdocument As New ReportDocument Dim strRptPath As String strRptPath = "d:\Attendance System\Attendance Reports\TodayAbsRpt.rpt" reportdocument.Load(strRptPath) Dim paramdefs As ParameterFieldDefinitions Dim paramdef As ParameterFieldDefinition Dim paramvalues As New ParameterValues Dim paramdisval As New ParameterDiscreteValue Dim todayval As Long todayval = Me.DTPsdate.Text.Substring(6, 4) & Mid(Me.DTPsdate.Text, 4, 2) & Me.DTPsdate.Text.Substring(0, 2) paramdefs = reportdocument.DataDefinition.ParameterFields For Each paramdef In paramdefs With paramdef Select Case .ParameterFieldName Case "DpttNm" paramdisval.Value = "'" & Me.cmbDptt.Text & "'" paramvalues.Add(paramdisval) paramdef.ApplyCurrentValues(paramvalues) Case "pDate" paramdisval.Value = todayval paramvalues.Add(paramdisval) paramdef.ApplyCurrentValues(paramvalues) End Select End With Next Dim frm As New FrmRpt frm.crViewer1.reportSource=reportdocument frm.Show() the crystal report viewet is on another form ....the problem is that the crystal report viewer doe'snt load the report please help me ur corporation is highly appreciated thanks

    M 1 Reply Last reply
    0
    • S saneng

      Hello I have to pass parameters to crystal report at runtime,i have already created reports in crystal report 9,below is my code Dim reportdocument As New ReportDocument Dim strRptPath As String strRptPath = "d:\Attendance System\Attendance Reports\TodayAbsRpt.rpt" reportdocument.Load(strRptPath) Dim paramdefs As ParameterFieldDefinitions Dim paramdef As ParameterFieldDefinition Dim paramvalues As New ParameterValues Dim paramdisval As New ParameterDiscreteValue Dim todayval As Long todayval = Me.DTPsdate.Text.Substring(6, 4) & Mid(Me.DTPsdate.Text, 4, 2) & Me.DTPsdate.Text.Substring(0, 2) paramdefs = reportdocument.DataDefinition.ParameterFields For Each paramdef In paramdefs With paramdef Select Case .ParameterFieldName Case "DpttNm" paramdisval.Value = "'" & Me.cmbDptt.Text & "'" paramvalues.Add(paramdisval) paramdef.ApplyCurrentValues(paramvalues) Case "pDate" paramdisval.Value = todayval paramvalues.Add(paramdisval) paramdef.ApplyCurrentValues(paramvalues) End Select End With Next Dim frm As New FrmRpt frm.crViewer1.reportSource=reportdocument frm.Show() the crystal report viewet is on another form ....the problem is that the crystal report viewer doe'snt load the report please help me ur corporation is highly appreciated thanks

      M Offline
      M Offline
      Muhammad Shahid Farooq
      wrote on last edited by
      #2

      Please add a single line after the following Line: frm.crViewer1.reportSource=reportdocument; crViewer1.Show(); frm.Show();

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups