Pages

Wednesday, February 4, 2015

Excel

On Error Resume Next
MsExcel.Workbooks.Add
MsExcel.Range("A1").Value = "Kode Studio"
MsExcel.Range("B1").Value = "Nama Band"
MsExcel.Range("C1").Value = "Durasi/Jam"
MsExcel.Range("D1").Value = "Total Bayar"

i = 1
Do While Not Adodc1.Recordset.EOF
MsExcel.Range("A" & i + 1).Value = Adodc1.Recordset("Kode_Studio")
MsExcel.Range("B" & i + 1).Value = Adodc1.Recordset("Nama_Band")
MsExcel.Range("C" & i + 1).Value = Adodc1.Recordset("Durasi")
MsExcel.Range("D" & i + 1).Value = Adodc1.Recordset("Total_Bayar")

i = i + 1
Adodc1.Recordset.MoveNext
Loop
MsExcel.Visible = True
Adodc1.Recordset.MoveFirst

Report

Set DataReportSimpanPinjam.DataSource = Adodc2
DataReportSimpanPinjam.Refresh
DataReportSimpanPinjam.WindowState = 2
DataReportSimpanPinjam.Show
Adodc2.Refresh

Muncul di cmb

StrSQL = "SELECT * FROM Studio WHERE Kode_Studio=" & txtKode.Text & ""
Set rs = Conn.Execute(StrSQL)
If Not rs.EOF Then
  harga = rs.Fields("Harga")
  If (cmbDurasi.Text <> "") Then
    txtharga.Text = harga * Val(cmbDurasi.Text)
  End If

Else
 txtharga.Text = 0

MsgBox "kode studio Tidak Ada"
 txtKode.SetFocus

 End If