Ana içeriğe atla

Çalıştığı Gün Sayısı Bulma (Recordsetle)


Option Compare Database
Sub tarih()
Dim fark As Integer
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("işçiler")
Do Until rst.EOF
fark = DateDiff("d", rst.Fields(2).Value, rst.Fields(3).Value)
rst.Edit
rst("gün_sayısı").Value = fark
rst.Update
rst.MoveNext
Loop
End Sub

Yorumlar

Bu blogdaki popüler yayınlar

04.10.2011 2.ÖRNEK(Veri Tabanı)

04.10.2011 2.ÖRNEK Sub hesapla() For x = 1 To 10 ' burada D sütunun içine A sütunun ilk harfi ve nokta sonra B sütunun birleşmiş halidir. Cells(x, 4) = Left(Cells(x, 1), 1) & "." & " " & Cells(x, 2) ' burada E sütunun içine A sütunuyla B sütunun birleştirmiştir. Cells(x, 5) = Cells(x, 1) & "  " & Cells(x, 2) Next x End Sub

Uygulama Sınavı S-1

İsmi A ile Başlayan Kişi Sayısı Option Compare Database Sub soru1() Dim db As Database Dim rst As Recordset Set db = CurrentDb Set rst = db.OpenRecordset("Tablo1") toplam = 0 Do Until rst.EOF If Left(rst.Fields("ad").Value, 1) = "a" Then toplam = toplam + 1 End If rst.MoveNext Loop MsgBox (toplam) End Sub

bir tablodan diğer bir tabloya veri aktarımı

Option Compare Database Dim db As Database Dim rst As Recordset Dim rs As Recordset2 Sub kayıt() Set db = CurrentDb() Set rst = db.OpenRecordset("tablo1") Set rs = db.OpenRecordset("yedek") Do Until rst.EOF rs.AddNew rs.Fields("isim").Value = rst.Fields("isim").Value rs.Update rst.MoveNext Loop End Sub