Melakukan Koneksi Crystal Report 8.5 dengan VB 6.0 Melakukan Pengkodean pada Setiap Form Aplikasi

48

4.7 Melakukan Koneksi Crystal Report 8.5 dengan VB 6.0

Aplikasi yang dibuat, juga diharapkan dapat digunakan untuk mencetak arsip secara tertulis. Perangkat lunak penunjang yang digunakan adalah Crystal Report 8.5. Dalam implementasinya, Crystal Report 8.5 tersebut dihubungkan pada setiap form aplikasi yang memiliki tugas untuk menghasilkan arsip tertulis. Langkah-langkah pengaturannya adalah sebagai berikut : 1. Tambahkan komponen Crystal Report pada setiap form yang memiliki tugas untuk menghasilkan arsip tertulis. 2. Klik komponen Crystal Report tersebut. 3. Lakukan pengaturan pada Report Filename sebagai berikut : Gambar 4.18 Report Filename 4. Lakukan pada setiap form yang menggunakan komponen Crystal Report. STIKOM SURABAYA 49

4.8 Melakukan Pengkodean pada Setiap Form Aplikasi

Pengkodean aplikasi dilakukan secara bertahap pada setiap form yang dibuat. Pengkodean dimulai dari form login, menu, jenis surat masuk, disposisi masuk, disposisi sekretaris, pengantar dalam, kartu surat masuk, dan kartu surat keluar. Langkah-langkah pengkodean pada aplikasi tersebut adalah sebagai berikut : 1. Pengkodean form login Kode-kode instruksi yang diimplementasikan pada form login adalah sebagai berikut : Dim pass As String Private Declare Function SetWindowRgn Lib user32 ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean As Long Private Sub Command1_Click Select Case Text3.Text Case Is = 1 nama = sriyanto pass = yanto123 Case Is = 2 nama = purwati pass = wati123 Case Is = 3 nama = indah pass = in123 Case Is = 4 nama = dian pass = dian123 Case Else MsgBox User tidak terdaftar Text1.Text = Text2.Text = Text3.Text = End Select If ValText3.Text = 1 And ValText3.Text = 4 Then If Text2.Text = pass Then MsgBox Login sukses Form_menu.Show Form_login.Hide Else MsgBox Password Anda Salah Text1.Text = Text2.Text = Text3.Text = End If End If End Sub Private Sub Command2_Click Unload Me End Sub STIKOM SURABAYA 50 2. Pengkodean form menu Kode-kode instruksi yang diimplementasikan pada form menu adalah sebagai berikut : Private Sub Command1_Click Form_jenis.Show Form_menu.Hide End Sub Private Sub Command2_Click Form_suratkeluar.Show Form_menu.Hide End Sub Private Sub Command3_Click Form_login.Show Form_menu.Hide End Sub 3. Pengkodean form jenis surat masuk Kode-kode instruksi yang diimplementasikan pada form ini adalah sebagai berikut : Private Sub Command1_Click Form_pengantardalam.Show Form_jenis.Hide End Sub Private Sub Command2_Click Form_disposisimasuk.Show Form_jenis.Hide End Sub Private Sub Command3_Click Unload Me End Sub Private Sub Command4_Click Form_menu.Show Form_jenis.Hide End Sub 4. Pengkodean form disposisi masuk Kode-kode instruksi yang diimplementasikan pada form ini adalah sebagai berikut : Public Conn As New ADODB.Connection Dim Mnomor As String Dim nomer As String Public Sub koneksi_database On Error GoTo NoConn With Conn If .State = adStateOpen Then Exit Sub .CursorLocation = adUseClient STIKOM SURABAYA 51 .ConnectionString = Provider=MSDASQL.1;Persist Security Info=False;User ID=dba;Data Source= Public Sub koneksi On Error GoTo konekErr If Conn.State = 1 Then Conn.Close Conn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + App.Path + \tu_dnspeternakan.mdb;Persist Security Info=False Exit Sub konekErr: MsgBox Gagal menghubungkan ke Database Kesalahan pada : Err.Description, vbCritical, Peringatan End Sub Private Sub Command1_Click Mnomor = InputBoxMasukkan Nomor Surat yang Dicari, Information Dim mkriteria As String If Mnomor Then mkriteria = Nomor_Surat = Mnomor With Adodc2.Recordset On Error Resume Next .Find mkriteria, , adSearchForward, 1 If Mnomor = Mnomor Then Call koneksi Adodc2.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + App.Path + \tu_dnspeternakan.mdb;Persist Security Info=False Adodc2.RecordSource = Select Surat_Dari, Tanggal_Surat, Nomor_Surat, Perihal, Diterima_Tanggal, Nomor_Agenda, Diteruskan_Kepada, Isi_Disposisi from disposisi_masuk where Nomor_Surat = Mnomor Adodc2.Refresh Text1.Text = Adodc2.RecordsetSurat_Dari tanggal = CStrAdodc2.RecordsetTanggal_Surat If Midtanggal, 2, 1 = Then Tgl = 0 + Lefttanggal, 1 If Midtanggal, 4, 1 = Then Bulan = 0 + Midtanggal, 3, 1 ElseIf Midtanggal, 5, 1 = Then Bulan = Midtanggal, 3, 2 End If ElseIf Midtanggal, 3, 1 = Then Tgl = Lefttanggal, 2 If Midtanggal, 5, 1 = Then Bulan = 0 + Midtanggal, 4, 1 ElseIf Midtanggal, 6, 1 = Then Bulan = Midtanggal, 4, 2 End If End If Tahun = Righttanggal, 4 nomer = Adodc2.RecordsetNomor_Surat Text2 = Leftnomer, 4 Text5 = Midnomer, 6, 4 Text4 = Midnomer, 11, 4 Text3 = Rightnomer, 4 Text7.Text = Adodc2.RecordsetPerihal tglterima = CStrAdodc2.RecordsetDiterima_tanggal If Midtglterima, 2, 1 = Then Combo2 = 0 + Lefttglterima, 1 If Midtglterima, 4, 1 = Then STIKOM SURABAYA 52 Combo3 = 0 + Midtglterima, 3, 1 ElseIf Midtglterima, 5, 1 = Then Combo3 = Midtglterima, 3, 2 End If ElseIf Midtglterima, 3, 1 = Then Combo2 = Lefttglterima, 2 If Midtglterima, 5, 1 = Then Combo3 = 0 + Midtglterima, 4, 1 ElseIf Midtglterima, 6, 1 = Then Combo3 = Midtglterima, 4, 2 End If End If Combo4 = Righttglterima, 4 Text6.Text = Adodc2.RecordsetNomor_Agenda Combo1.Text = Adodc2.RecordsetDiteruskan_Kepada Text8.Text = Adodc2.RecordsetIsi_Disposisi End If On Error GoTo 0 If .EOF Then MsgBox Data Tidak Ditemukan End If End With End If End Sub Private Sub Command2_Click Form_jenis.Show Form_disposisimasuk.Hide End Sub Private Sub btnCetak_Click CrystalReport1.SelectionFormula = {disposisi_masuk.Nomor_Surat}= Text2 Text5 Text4 Text3 CrystalReport1.WindowState = crptMaximized CrystalReport1.RetrieveDataFiles CrystalReport1.Action = 1 End Sub Private Sub Form_Load koneksi Adodc2.ConnectionString = Conn.ConnectionString Adodc2.RecordSource = select from disposisi_masuk Adodc1.Refresh Set Adodc2 = New Adodb.Recordset Set DataGrid1.DataSource = Adodc2 Set view = aplikasi.OpenReportApp.Path \reportd_masuk view.DiscardSavedData End Sub Private Sub Mn_keluar_Click Unload Me End Sub Sub bersih Text1 = Text2 = Tgl = Tgl Bulan = Bulan Text5 = Text4 = Text3 = Tahun = Tahun Text6 = Text7 = Text8 = STIKOM SURABAYA 53 Combo2 = Tgl Combo3 = Bulan Combo4 = Tahun Combo1 = ------------------------------------ End Sub Private Sub Mn_simpan_Click Dim tanggal As String Dim tglterima As String If LenText2 4 And LenText5 4 And LenText4 4 And LenText3 4 Then MsgBox Harap masukkan 4 digit nomor pada setiap kolom Text2.Text = Text5.Text = Text4.Text = Text3.Text = End If tanggal = Tgl Bulan + Tahun nomer = Text2 Text5 Text4 Text3 tglterima = Combo2 Combo3 + Combo4 Adodc2.Recordset.Open Adodc2.Recordset.AddNew perintah untuk menyimpan data yang di inputkan pada textbox ke dalam field database Adodc2.RecordsetSurat_Dari = Text1.Text Adodc2.RecordsetTanggal_Surat = tanggal Adodc2.RecordsetNomor_Surat = nomer Adodc2.RecordsetPerihal = Text7.Text Adodc2.RecordsetDiterima_tanggal = tglterima Adodc2.RecordsetNomor_Agenda = Text6.Text Adodc2.RecordsetDiteruskan_Kepada = Combo1.Text Adodc2.RecordsetIsi_Disposisi = Text8.Text update = perintah untuk mengupdate data yang telah ditambahkan Adodc2.Recordset.Update perintah untuk merefresh grid ketika data sudah ditambahkan DataGrid1.Refresh perintah untuk mengkosongkan textbox setelah data disimpan If Combo1.ListIndex = 0 Then Form_disposisisekretaris.Show Form_disposisimasuk.Hide Else Call bersih Form_kartusuratmasuk.Show Form_disposisimasuk.Hide End If End Sub 5. Pengkodean form disposisi masuk Kode-kode instruksi yang diimplementasikan pada form ini adalah sebagai berikut : Private Sub Form_Load koneksi Adodc1.ConnectionString = Conn.ConnectionString Adodc1.RecordSource = select from disposisi_sekretaris Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 Text1.Text = Form_disposisimasuk.Text1.Text Tgl = Form_disposisimasuk.Tgl Bulan = Form_disposisimasuk.Bulan Tahun = Form_disposisimasuk.Tahun Text2.Text = Form_disposisimasuk.Text2.Text STIKOM SURABAYA 54 Text5.Text = Form_disposisimasuk.Text5.Text Text4.Text = Form_disposisimasuk.Text4.Text Text3.Text = Form_disposisimasuk.Text3.Text Text7.Text = Form_disposisimasuk.Text7.Text Combo2.Text = Form_disposisimasuk.Combo2.Text Combo3.Text = Form_disposisimasuk.Combo3.Text Combo4.Text = Form_disposisimasuk.Combo4.Text Text6.Text = Form_disposisimasuk.Text6.Text End Sub Private Sub Command1_Click Mnomor = InputBoxMasukkan Nomor Surat yang Dicari Dim mkriteria As String If Mnomor Then mkriteria = Nomor_Surat = Mnomor With Adodc1.Recordset On Error Resume Next .Find mkriteria, , adSearchForward, 1 If Mnomor = Mnomor Then Call koneksi Adodc1.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + App.Path + \tu_dnspeternakan.mdb;Persist Security Info=False Adodc1.RecordSource = Select Surat_Dari, Tanggal_Surat, Nomor_Surat, Perihal, Diterima_Tanggal, Nomor_Agenda, Diteruskan_Ke, Isi_Disposisi from disposisi_sekretaris where Nomor_Surat = Mnomor Text1.Text = Adodc1.RecordsetSurat_Dari tanggal = CStrAdodc1.RecordsetTanggal_Surat If Midtanggal, 2, 1 = Then Tgl = 0 + Lefttanggal, 1 If Midtanggal, 4, 1 = Then Bulan = 0 + Midtanggal, 3, 1 ElseIf Midtanggal, 5, 1 = Then Bulan = Midtanggal, 3, 2 End If ElseIf Midtanggal, 3, 1 = Then Tgl = Lefttanggal, 2 If Midtanggal, 5, 1 = Then Bulan = 0 + Midtanggal, 4, 1 ElseIf Midtanggal, 6, 1 = Then Bulan = Midtanggal, 4, 2 End If End If Tahun = Righttanggal, 4 nomer = Adodc1.RecordsetNomor_Surat Text2 = Leftnomer, 4 Text5 = Midnomer, 6, 4 Text4 = Midnomer, 11, 4 Text3 = Rightnomer, 4 Text7.Text = Adodc1.RecordsetPerihal tglterima = CStrAdodc1.RecordsetDiterima_tanggal If Midtglterima, 2, 1 = Then Combo2 = 0 + Lefttglterima, 1 If Midtglterima, 4, 1 = Then Combo3 = 0 + Midtglterima, 3, 1 ElseIf Midtglterima, 5, 1 = Then Combo3 = Midtglterima, 3, 2 End If ElseIf Midtglterima, 3, 1 = Then Combo2 = Lefttglterima, 2 STIKOM SURABAYA 55 If Midtglterima, 5, 1 = Then Combo3 = 0 + Midtglterima, 4, 1 ElseIf Midtglterima, 6, 1 = Then Combo3 = Midtglterima, 4, 2 End If End If Combo4 = Righttglterima, 4 Text6.Text = Adodc1.RecordsetNomor_Agenda Combo1.Text = Adodc1.RecordsetDiteruskan_Ke Text8.Text = Adodc1.RecordsetIsi_Disposisi End If On Error GoTo 0 If .EOF Then MsgBox Data Tidak Ditemukan End If End With End If End Sub Private Sub Mn_keluar_Click End End Sub Private Sub Mn_simpan_Click Dim tanggal As String Dim tglterima As String If LenText2 4 And LenText5 4 And LenText4 4 And LenText3 4 Then MsgBox Harap masukkan 4 digit nomor pada setiap kolom Text2.Text = Text5.Text = Text4.Text = Text3.Text = End If tanggal = Tgl Bulan + Tahun nomer = Text2 Text5 Text4 Text3 tglterima = Combo2 Combo3 + Combo4 Adodc2.Recordset.Open Adodc1.Recordset.AddNew perintah untuk menyimpan data yang di inputkan pada textbox ke dalam field database Adodc1.RecordsetSurat_Dari = Text1.Text Adodc1.RecordsetTanggal_Surat = tanggal Adodc1.RecordsetNomor_Surat = nomer Adodc1.RecordsetPerihal = Text7.Text Adodc1.RecordsetDiterima_tanggal = tglterima Adodc1.RecordsetNomor_Agenda = Text6.Text Adodc1.RecordsetDiteruskan_Ke = Combo1.Text Adodc1.RecordsetIsi_Disposisi = Text8.Text update = perintah untuk mengupdate data yang telah ditambahkan Adodc1.Recordset.Update perintah untuk merefresh grid ketika data sudah ditambahkan DataGrid1.Refresh perintah untuk mengkosongkan textbox setelah data disimpan Text1 = Text2 = Tgl = Tgl Bulan = Bulan Tahun = Tahun Text6 = Text7 = Text8 = Combo1 = List1 = List2 = STIKOM SURABAYA 56 Form_kartusuratmasuk.Show Form_disposisisekretaris.Hide End Sub 6. Pengkodean form pengantar dalam Kode-kode instruksi yang diimplementasikan pada form ini adalah sebagai berikut : Private Sub Form_Load koneksi Adodc1.ConnectionString = Conn.ConnectionString Adodc1.RecordSource = select from s_rutin Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 End Sub Private Sub Command1_Click Dim tanggal As String Dim nomer As String Dim tglterima As String Dim tglkirim As String tanggal = Tgl Bulan + Tahun nomer = Text6 Text5 Text4 Text3 tglterima = Combo3 Combo2 + Combo1 tglkirim = Combo6 Combo5 + Combo4 Adodc1.Recordset.AddNew perintah untuk menyimpan data yang di inputkan pada textbox ke dalam field database Adodc1.RecordsetKepada = Text1.Text Adodc1.RecordsetAsal_Surat = Text2.Text Adodc1.RecordsetTanggal_Surat = tanggal Adodc1.RecordsetNomor_Surat = nomer Adodc1.RecordsetKeterangan = Text9.Text Adodc1.RecordsetDiterima_tanggal = tglterima Adodc1.RecordsetDikirim_tanggal = tglkirim Adodc1.RecordsetPenerima = Text7.Text Adodc1.RecordsetPengirim = Text8.Text update = perintah untuk mengupdate data yang telah ditambahkan Adodc1.Recordset.Update perintah untuk merefresh grid ketika data sudah ditambahkan DataGrid1.Refresh perintah untuk mengkosongkan textbox setelah data disimpan Text1 = Text2 = Tgl = Tgl Bulan = Bulan Tahun = Tahun Text3 = Text4 = Text5 = Text6 = Text7 = Text8 = Text9 = Combo1 = Combo2 = Combo3 = Combo4 = Combo5 = Combo6 = End Sub Private Sub Command3_Click Form_jenis.Show Form_pengantardalam.Hide STIKOM SURABAYA 57 End Sub Private Sub Command4_Click Unload Me End Sub 7. Pengkodean form kartu surat masuk Kode-kode instruksi yang diimplementasikan pada form ini adalah sebagai berikut : Public Conn As New ADODB.Connection Dim Mkode As String Public Sub koneksi_database On Error GoTo NoConn With Conn If .State = adStateOpen Then Exit Sub .CursorLocation = adUseClient .ConnectionString = Provider=MSDASQL.1;Persist Security Info=False;User ID=dba;Data Source= End With End Sub Public Sub koneksi On Error GoTo konekErr If Conn.State = 1 Then Conn.Close Conn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + App.Path + \tu_dnspeternakan.mdb;Persist Security Info=False Exit Sub konekErr: MsgBox Gagal menghubungkan ke Database Kesalahan pada : Err.Description, vbCritical, Peringatan End Sub Private Sub Command3_Click CrystalReport1.SelectionFormula = {krt_s_masuk.Kode}= Text2.Text CrystalReport1.WindowState = crptMaximized CrystalReport1.RetrieveDataFiles CrystalReport1.Action = 1 End Sub Private Sub Command4_Click Mkode = InputBoxMasukkan Kode Surat Masuk yang Dicari, Information Dim mkriteria As String If Mkode Then mkriteria = Kode = Mkode With Adodc1.Recordset On Error Resume Next .Find mkriteria, , adSearchForward, 1 Call koneksi Adodc1.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + App.Path + \tu_dnspeternakan.mdb;Persist Security Info=False Adodc1.RecordSource = Select Index, Kode, Nomor_Urut, Isi_Ringkas, Dari, Tanggal_Surat, Nomer_Surat, Lampiran, Pengolah, Tanggal_Diteruskan, Catatan from krt_s_masuk where Kode = Mkode Text1.Text = Adodc1.RecordsetIndex Text2.Text = Adodc1.RecordsetKode Text3.Text = Adodc1.RecordsetNomer_Urut Text14.Text = Adodc1.RecordsetIsi_Ringkas Text15.Text = Adodc1.RecordsetDari STIKOM SURABAYA 58 menampilkan tanggal tanggal = CStrAdodc1.RecordsetTanggal_Surat If Midtanggal, 2, 1 = Then Text6 = 0 + Lefttanggal, 1 If Midtanggal, 4, 1 = Then Text10 = 0 + Midtanggal, 3, 1 ElseIf Midtanggal, 5, 1 = Then Text10 = Midtanggal, 3, 2 End If ElseIf Midtanggal, 3, 1 = Then Text6 = Lefttanggal, 2 If Midtanggal, 5, 1 = Then Text10 = 0 + Midtanggal, 4, 1 ElseIf Midtanggal, 6, 1 = Then Text10 = Midtanggal, 4, 2 End If End If Text11 = Righttanggal, 4 ---------------------------------------- Text5.Text = Adodc1.RecordsetNomer_Surat Text4.Text = Adodc1.RecordsetLampiran Text9.Text = Adodc1.RecordsetPengolah --------------------------------------------------- tglditeruskan = CStrAdodc1.RecordsetTanggal_Diteruskan If Midtglditeruskan, 2, 1 = Then Text8 = 0 + Lefttglditeruskan, 1 If Midtglditeruskan, 4, 1 = Then Text12 = 0 + Midtglditeruskan, 3, 1 ElseIf Midtglditeruskan, 5, 1 = Then Text12 = Midtglditeruskan, 3, 2 End If ElseIf Midtglditeruskan, 3, 1 = Then Text8 = Lefttglditeruskan, 2 If Midtglditeruskan, 5, 1 = Then Text12 = 0 + Midtglditeruskan, 4, 1 ElseIf Midtglditeruskan, 6, 1 = Then Text12 = Midtglditeruskan, 4, 2 End If End If Text13 = Righttglditeruskan, 4 ------------------------------------------------------ Text16.Text = Adodc1.RecordsetCatatan On Error GoTo 0 If .EOF Then MsgBox Data Tidak Ditemukan End If End With End If End Sub Private Sub Form_Load koneksi Adodc1.ConnectionString = Conn.ConnectionString Adodc1.RecordSource = select from krt_s_masuk Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 End Sub Private Sub Command1_Click STIKOM SURABAYA 59 Dim tanggal As String Dim Tgl As String tanggal = Text6 Text10 + Text11 Tgl = Text8 Text12 + Text13 Adodc2.Recordset.Open Adodc1.Recordset.AddNew perintah untuk menyimpan data yang di inputkan pada textbox ke dalam field database Adodc1.RecordsetIndex = Text1.Text Adodc1.RecordsetKode = Text2.Text Adodc1.RecordsetNomer_Urut = Text3.Text Adodc1.RecordsetIsi_Ringkas = Text14.Text Adodc1.RecordsetDari = Text15.Text Adodc1.RecordsetTanggal_Surat = tanggal Adodc1.RecordsetNomer_Surat = Text5.Text Adodc1.RecordsetLampiran = Text4.Text Adodc1.RecordsetPengolah = Text9.Text Adodc1.RecordsetTanggal_Diteruskan = Tgl Adodc1.RecordsetTanda_Terima = Text7.Text Adodc1.RecordsetCatatan = Text16.Text update = perintah untuk mengupdate data yang telah ditambahkan Adodc1.Recordset.Update perintah untuk merefresh grid ketika data sudah ditambahkan DataGrid1.Refresh perintah untuk mengkosongkan textbox setelah data disimpan Text1 = Text2 = Text3 = Text4 = Text5 = Text6 = Text7 = Text8 = Text9 = Text10 = Text11 = Text12 = Text13 = Text14 = Text15 = Text16 = End Sub Private Sub Command2_Click Unload Me End Sub 8. Pengkodean form kartu surat keluar Kode-kode instruksi yang diimplementasikan pada form ini adalah sebagai berikut : Public Conn As New ADODB.Connection Dim Mkode As String Public Sub koneksi On Error GoTo konekErr If Conn.State = 1 Then Conn.Close Conn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + App.Path + \tu_dnspeternakan.mdb;Persist Security Info=False Exit Sub konekErr: STIKOM SURABAYA 60 MsgBox Gagal menghubungkan ke Database Kesalahan pada : Err.Description, vbCritical, Peringatan End Sub Private Sub Command1_Click Dim tanggal As String tanggal = Text8 Text12 + Text13 Adodc2.Recordset.Open Adodc1.Recordset.AddNew perintah untuk menyimpan data yang di inputkan pada textbox ke dalam field database Adodc1.RecordsetIndex = Text1.Text Adodc1.RecordsetKode = Text2.Text Adodc1.RecordsetNomer_Urut = Text3.Text Adodc1.RecordsetIsi_Ringkas = Text14.Text Adodc1.RecordsetKepada = Text15.Text Adodc1.RecordsetPengolah = Text9.Text Adodc1.RecordsetTanggal_Surat = tanggal Adodc1.RecordsetLampiran = Text7.Text Adodc1.RecordsetCatatan = Text4.Text update = perintah untuk mengupdate data yang telah ditambahkan Adodc1.Recordset.Update perintah untuk merefresh grid ketika data sudah ditambahkan DataGrid1.Refresh perintah untuk mengkosongkan textbox setelah data disimpan Text1 = Text2 = Text3 = Text4 = Text7 = Text8 = Text9 = Text12 = Text13 = Text14 = Text15 = End Sub Private Sub Command3_Click CrystalReport1.SelectionFormula = {s_keluar.Kode}= Text2 CrystalReport1.WindowState = crptMaximized CrystalReport1.RetrieveDataFiles CrystalReport1.Action = 1 End Sub Private Sub Command5_Click Mkode = InputBoxMasukkan Kode Surat yang Dicari, Information Dim mkriteria As String If Mkode Then mkriteria = Kode = Mkode With Adodc1.Recordset On Error Resume Next .Find mkriteria, , adSearchForward, 1 Call koneksi Adodc1.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + App.Path + \tu_dnspeternakan.mdb;Persist Security Info=False Adodc1.RecordSource = Select Index, Kode, Nomor_Urut, Isi_Ringkas, Kepada, Pengolah, Tanggal_Surat, Lampiran, Catatan from disposisi_masuk where Kode = Mkode Text1.Text = Adodc1.RecordsetIndex Text2.Text = Adodc1.RecordsetKode Text3.Text = Adodc1.RecordsetNomer_Urut Text14.Text = Adodc1.RecordsetIsi_Ringkas Text15.Text = Adodc1.RecordsetKepada STIKOM SURABAYA 61 Text9.Text = Adodc1.RecordsetPengolah tanggal = CStrAdodc1.RecordsetTanggal_Surat If Midtanggal, 2, 1 = Then Text8 = 0 + Lefttanggal, 1 If Midtanggal, 4, 1 = Then Text12 = 0 + Midtanggal, 3, 1 ElseIf Midtanggal, 5, 1 = Then Text12 = Midtanggal, 3, 2 End If ElseIf Midtanggal, 3, 1 = Then Text8 = Lefttanggal, 2 If Midtanggal, 5, 1 = Then Text12 = 0 + Midtanggal, 4, 1 ElseIf Midtanggal, 6, 1 = Then Text12 = Midtanggal, 4, 2 End If End If Text13 = Righttanggal, 4 Text7.Text = Adodc1.RecordsetLampiran Text4.Text = Adodc1.RecordsetCatatan On Error GoTo 0 If .EOF Then MsgBox Data Tidak Ditemukan End If End With End If End Sub Private Sub Form_Load koneksi Adodc1.ConnectionString = Conn.ConnectionString Adodc1.RecordSource = select from s_keluar Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 End Sub Private Sub Command2_Click Unload Me End Sub Private Sub Command4_Click Form_menu.Show Form_suratkeluar.Hide End Sub STIKOM SURABAYA 62

BAB V PEMBAHASAN DAN HASIL