Thread: create log file
View Single Post
  #8 (permalink)  
Old 05-21-2008, 10:48 PM
yonghan yonghan is offline
Newbie
 
Join Date: May 2008
Posts: 19
Credits: 0
Rep Power: 3
yonghan is on a distinguished road
Default Re: create log file

Ok,thanks..I also want to ask for help again..I wrote a function to add data to access.I'm intending to store the sold goods into it,and check when a transaction was made,are there the same date,code,name of the goods.If there are same,then the quantity field will be updated..I create it to see the most sold goods..Here are the codes..Please help me to check it..Or are there another way to get the most sold goods??Thanks..

Private Sub terlaku()
Dim a, Jumlah As Integer
Dim kode As String

For a = txtKode.LBound To txtKode.UBound
If txtKode(a).Text <> "" Then
If txtQty(a).Text <> "" Then
kode = txtKode(a).Text
rsterlaku.AddNew
rsterlaku!ID = CStr(Date) & " - " & strUser
rsterlaku!tgl = Date
rsterlaku!kd_brg = txtKode(a).Text
rsterlaku!nm_brg = txtNama(a).Text
rsterlaku!Qty = txtQty(a).Text
rsterlaku!User = strUser
rsterlaku!Update = Now
If rsterlaku.RecordCount > 0 Then
rsterlaku.MoveFirst
rsterlaku.Index = "tgl"
rsterlaku.Seek "=", Date
If Not rsterlaku.NoMatch Then
rsterlaku.Index = "kd_brg"
rsterlaku.Seek "=", kode
If Not rsterlaku.NoMatch Then
rsterlaku.Index = "user"
rsterlaku.Seek "=", lbluser.Caption
If Not rsterlaku.NoMatch Then
Jumlah = CInt(rsterlaku!Qty)
rsterlaku.Edit
rsterlaku!Qty = CStr(Jumlah + CInt(rsterlaku!Qty))
rsterlaku!User = strUser
rsterlaku!Update = Now
Else
If rsterlaku.NoMatch Then
rsterlaku.AddNew
rsterlaku!ID = CStr(Date) & " - " & strUser
rsterlaku!tgl = Date
rsterlaku!kd_brg = txtKode(a).Text
rsterlaku!nm_brg = txtNama(a).Text
rsterlaku!Qty = txtQty(a).Text
rsterlaku!User = strUser
rsterlaku!Update = Now
End If
End If
End If
End If
End If
End If
End If
rsterlaku.Update
Next a
End Sub
Reply With Quote