0

Im using visualstudio 2010, ms access and crystal report 8.5. How to code only 1 report per 1 entry data? what i mean for 1 entry data are: 1: https://i.stack.imgur.com/y5R2C.jpg .

i have 6 entry data atm. this solution works, but it only shows 1st data entry, idk how to show 2nd or 5rd, etc per reportstack overflow link. Please let me know your answer completely if after the code, i still need to do that(stack overflow link). Thanks a lot.

My code (cant show other than first entry data):

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
  • //The other code that im trying to show 1 report per data entry are :

     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
    

    End Class

  • Are you wanting a new page for each data row in the data set, or do you only want a specific data row to print based upon an input value? Also, do you have any grouping within you data? – R. McMillan Sep 17 '18 at 11:13
  • @R.McMillan each specific data row = 1 report, and 1 report often has 5 pages. I want to make a function to calls one of them(rows) by selecting 1 of them with ComboBox1 (dataset: 2012, 2013, 2014, 2015, 2016, 2017) then click a button to calls the report (example: select 2015 on ComboBox1 then click a button to calls the report). Also idk how to grouping, but i think i didnt have it. – Ricky Limanto Sep 18 '18 at 02:47

0 Answers0