Kamis, 30 Agustus 2012

Simpan Data Dengan Cara Looping

CARA 1
Private Sub transdata()
   Dim i As Integer
   INV.RecordSource = "select * from inv ORDER BY KODE"
   INV.Refresh
   ST00TEMP.RecordSource = "select * from st00temp"
   ST00TEMP.Refresh
   ST000000.RecordSource = "select * from st000000"
   ST000000.Refresh
   Do While Not ST00TEMP.Recordset.EOF
     ST000000.Recordset.AddNew
     For i = 0 To 10
        ST000000.Recordset.Fields(i) = ST00TEMP.Recordset.Fields(i)
     Next
   ST000000.Recordset.Update
   End If
   ST00TEMP.Recordset.MoveNext
   Loop

On Error Resume Next
 MsgBox "Please Wait while Print.......", vbOKOnly + vbInformation
 ST00TEMP.RecordSource = "delete * from st00temp"
 ST00TEMP.Refresh
 ST00TEMP.RecordSource = " select * from st00temp"
 ST00TEMP.Refresh
 DataGrid1.ReBind
End Sub

CARA 2

       Do While Not Adodc1.Recordset.EOF
       With ST00TEMP.Recordset
         .AddNew
         .Fields("notran") = no
         .Fields("PLU") = Adodc1.Recordset.Fields("Paket")
         .Fields("name") = Adodc1.Recordset.Fields("Barang")
         .Fields("qty") = Text4.Text
         .Fields("price") = "0" 'Adodc1.Recordset.Fields("harga")
         .Fields("total") = "0" 'Text4.Text * Adodc1.Recordset.Fields("harga")
         .Fields("discpct") = Text7.Text
         '.Fields("flag") = Text6.Text
         .Fields("tgl") = Date
         .Fields("jam") = Time
         .Update
       End With
       Adodc1.Recordset.MoveNext
       Loop

1 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...