di modul connection
Public KONEKSI As StringPublic MyDB As New ADODB.ConnectionPrivate Sub Main()On Error GoTo PESANWith MyDBKONEKSI = “Provider=SQLOLEDB.1;” & _“Password=” & namapassword & “;” & _“User ID=” & namaUserID & “;” & _“Initial Catalog =” & namaDB & “;” & _“Data Source=” & namaoperator & “”.CursorLocation = 3.Open KONEKSIIf .State = adStateOpen ThenMenu.ShowElseMsgBox “CONNECTION VIEW ERROR”, vbOKOnly + vbInformation, “KONEKSI BARU”End IfEnd WithExit Sub
PESAN:MsgBox “ERROR 010 :” & vbTab & Err.Description & vbCrLf & ” BUAT KONEKSI BARU “, vbCritical + vbOKOnly, “ERROR”End Sub
Private Sub cmdprint_Click()Dim RptKeluar As New LapTanggalMasukDim RsKeluar As New ADODB.RecordsetIf dtawal.Value > dtakhir.Value ThenMsgBox “Tanggal Mulai tidak boleh lebih kecil dari tanggal akhir”, vbInformation, “PRINT”dtawal.SetFocusExit SubEnd If
StrSQL = “SELECT * FROM OBAT_MASUK where(Tanggal between ‘” & (Format(dtawal.Value, “mm/dd/yyyy”)) & “‘ and ‘” & ((Format(dtakhir.Value, “mm/dd/yyyy”))) & “‘)”RsKeluar.Open StrSQL, MyDB, adOpenKeyset, adLockOptimisticRptKeluar.ReportTitle = “LAPORAN OBAT MASUK/KELUAR DARI TANGGAL” & vbCrLf & Format(dtawal.Value, “DD-MM-YYYY”) & space(3) & “S/D” & space(3) & Format(dtakhir.Value, “DD-MM-YYYY”)RptKeluar.Database.SetDataSource RsKeluarCRViewer1.Visible = TrueCRViewer1.ReportSource = RptKeluarCRViewer1.DisplayGroupTree = FalseCRViewer1.DisplayToolbar = TrueCRViewer1.ViewReportCRViewer1.Zoom 100Screen.MousePointer = vbDefaultpictgl.Visible = Falsepicobt.Visible = FalseMe.WindowState = 2
End SubPrivate Sub Command2_Click()Unload MeEnd Sub
End SubPrivate Sub Command2_Click()Unload MeEnd Sub
Tidak ada komentar:
Posting Komentar
hay friend... sebelum exit, jgn lupa tinggalkan comment dulu ya...
kalau mau bertanya bisa tulis komentar atau email/fb ke: aranama@ymail.com
thank you...