Create Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6

Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6

In this article I will be sharing Reporting Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6. In the previous article I discussed about Adding Input, Update, Delete and Find Microsoft Access database in Microsoft Visual Basic 6, which is a continuation of the previous article, The report is one of information that is important when we are designing an information system. The report contains information on the data that is owned by a company that the information should be made as accurate as possible.

Software I use Active Reports this time is very rarely heard but produced a better report than the report data that is owned by Microsoft Visual Basic 6, but it works almost the same as DataReport. Active Reports integrates directly with Microsoft Visual Basic 6 so that when Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6 we directly work with Microsoft Visual Basic 6.

Of course, before Reporting Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6 we must first install the Active Reports. If you do not have simply searching Active Reports and Active Reports Download on google. Furthermore, we just add the Active Reports to the project earlier. Right click on the project then the Add then select Data Dynamics ActiveReports 2.0 as shown below:

Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6_1

ActiveReport1 window will appear as shown below:

Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6

In this article we will create a report for each class so that the students of the report we will look at the data for each class. Therefore, we must add groupheader  for grouping of data for each class. By right-clicking on the window ActiveReport1 work as shown below:

Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6_2

So it becomes like the view from the window ActiveReport1, so now we have had groupheader1 which we will use for grouping Siswa based on Kelas.

Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6_3

At ActiveReports we use ADO similar with ADODC recordset we use a lot so we only accommodate data into ADO then display in the ActiveReports.

Once finished designing the ActiveReports like the picture above, we will set the group header, the detail in the ActiveReports. Place the source code below into ActiveReports:


Private Sub Detail_BeforePrint()
Me.Field1.Height = Me.Detail.Height 'digunakan untuk mengatur tinggi kolom sesuai panjang data
Me.Field2.Height = Me.Detail.Height
Me.Field3.Height = Me.Detail.Height
Me.Field4.Height = Me.Detail.Height
End Sub

Private Sub Detail_Format()
With ADO.Recordset
If Not .EOF Then
Me.Field2 = Val(Me.Field2) +
Me.Field3 = .Fields("nomor_induk").Value
Me.Field4 = .Fields("nama").Value
End If
End With
End Sub

Private Sub GroupHeader1_Format()
With ADO.Recordset
If Not .EOF Then
Me.Field2 = "0" ' reset nomor urut
Me.Field1 = .Fields("kelas").Value
End If
End With
End Sub

Once the code above is placed now we create a form to display a report. in Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6 we have to put into a component of SQL syntax, here I use the CommandButton to display the following students report as shown below.

Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6_4

When CommandButton clicked it will display a report of students by grade as shown below: Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6_5

To be able to display as described above, the source code to the CommandButton1_Click event as follows:


Private Sub Command1_Click()
Call BukaKoneksi

Dim SQLlaporan As String
SQLlaporan = "Select kelas.kelas_id as kode_kelas,nama_kelas,siswa.NIS,nama_siswa " & _
"from siswa inner join (kelas inner join kelas_siswa on kelas.kelas_id=kelas_siswa.kelas_id) on siswa.nis=kelas_siswa.nis"

With ActiveReport1
.ADO.ConnectionString = LokasiDB
.ADO.Source = SQLlaporan
.Show
End With
End Sub

After entered click groupheader1 and set of data fields into kode_kelas that grouping by grade and statements can appear as above. Although it was rarely used but ActiveReports very easy to use for beginners because we only play with the data recordset as ADODC. For Creating Reports Using Active Reports with Microsoft Access database in Microsoft Visual Basic 6 has been completed. Good luck.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s