如何制作表格和代码以每1个Enty数据仅显示1个报告?

时间:2018-09-17 08:32:30

标签: visual-studio crystal-reports

我正在使用visualstudio 2010,ms访问和Crystal Report 8.5。 如何为每1个条目数据仅编写1个报告?我对1个条目数据的意思是:   1https://i.stack.imgur.com/y5R2C.jpg

我有6个输入数据atm。此解决方案有效,但每个报告仅显示第1个数据条目,idk如何显示第2个或第5个数据,stack overflow link。如果在代码之后,我仍然需要这样做(堆栈溢出链接),请让我完全知道您的答案。非常感谢。

我的代码(除了首次输入数据,不能显示):

Imports System.Data.OleDb
Public Class Laporanutama
Public CONN As OleDbConnection
Public CMD As OleDbCommand
    Public DS As New DataSet
    Public DA As OleDbDataAdapter
    Public RD As OleDbDataReader
    Public LokasiData As String
    Dim awal As String
    Dim akhir As String
    Dim ae As String

    Sub Koneksi()
        LokasiData = "provider=microsoft.jet.oledb.4.0;data source=distribusi.mdb"
        CONN = New OleDbConnection(LokasiData)
        If CONN.State = ConnectionState.Closed Then
            CONN.Open()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        CR.ReportFileName = "BPL1.rpt"
        CR.WindowState = Crystal.WindowStateConstants.crptMaximized
        CR.RetrieveDataFiles()
        CR.Action = 1
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'lap1.Show()
        'CR.ReportFileName = "Stok.rpt"
        'CR.WindowState = Crystal.WindowStateConstants.crptMaximized
        'CR.RetrieveDataFiles()
        'CR.Action = 1
    End Sub
End Class
  • //我试图为每个数据条目显示1个报告的其他代码是:

     Imports System.Data.OleDb
    Public Class LaporanBPL
    Public CONN As OleDbConnection
    Public CMD As OleDbCommand
    Public DS As New DataSet
    Public DA As OleDbDataAdapter
    Public RD As OleDbDataReader
    Public LokasiData As String
    Dim awal As String
    Dim akhir As String
    Dim ae As String
    
    
    Sub Koneksi()
        LokasiData = "provider=microsoft.jet.oledb.4.0;data source=C:\Users\ASUS\Documents\Visual Studio 2010\Projects\WindowsApplication14\WindowsApplication14\Database1.mdb"
        CONN = New OleDbConnection(LokasiData)
        If CONN.State = ConnectionState.Closed Then
            CONN.Open()
        End If
    End Sub
    
    
    Sub TampilTanggal()
    
        Call Koneksi()
        CMD = New OleDbCommand("select no_kkp from tb_bpl", CONN)
        RD = CMD.ExecuteReader
        Do While RD.Read
            ComboBox1.Items.Add(RD.Item(0))
        Loop
    End Sub
    
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If ComboBox1.Text = "" Then
            MsgBox("Pilih dulu Tahunnya")
            Exit Sub
        Else
            CR.SelectionFormula = "({tb_bpl.no_kkp})=" & Val(ComboBox1.Text)
            CR.ReportFileName = "BPL1.rpt"
            CR.WindowState = Crystal.WindowStateConstants.crptMaximized
            CR.RetrieveDataFiles()
            CR.Action = 1
        End If
    End Sub
    
    Private Sub LaporanBPL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call TampilTanggal()
    End Sub
    
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    
    End Sub
    

    结束课程

0 个答案:

没有答案