Dim rbyr, rsim, rs, rdel, rsem, rmhs, rspp, rb As Recordset
Dim bl As String
Private Sub Command1_Click()
Set rsim = New ADODB.Recordset
rsim.Open "select * from bayar", kon, adOpenKeyset, adLockBatchOptimistic
For a = 1 To Val(Text6)
bl = Val(bl) + 1
If bl < 10 Then bl = "0" & Trim(Str(bl))
rsim.AddNew
rsim!nim = Text1
rsim!blth = bl & Format(tgl, "yy")
rsim!tglb = Format(Now(), Date)
rsim.UpdateBatch adAffectAllChapters
Next a
dg.DataSource = rsim
ksg
End Sub
Private Sub Form_Load()
konek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\STMIK 2011\SEMESTER 2\PEMROGRAMAN BASIS DATA 1\spp\spp.mdb;Persist Security Info=False"
Set kon = New ADODB.Connection
kon.Open konek
kon.CursorLocation = adUseClient
Set rdel = New ADODB.Recordset
rdel.Open "select * from bayar", kon, adOpenDynamic, adLockOptimistic
Set dg.DataSource = rdel
ksg
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim b, t As String
If KeyAscii = 13 Then
Set rmhs = New ADODB.Recordset
rmhs.Open "Select * From mhs where nim = '" & Trim(Text1) & "'", kon, adOpenKeyset, adLockReadOnly
If rmhs.EOF = False Then
Text2 = rmhs!nama
Set rspp = New ADODB.Recordset
rspp.Open "Select * From mspp where right(tahun,2) = '" & Mid(Text1, 2, 2) & "'", kon, adOpenKeyset, adLockReadOnly
Text3 = rspp!nominal & "00"
Set rb = New ADODB.Recordset
rb.Open "Select * From bayar where nim = '" & Trim(Text1) & "' order by blth desc", kon, adOpenKeyset, adLockReadOnly
If rb.RecordCount = 0 Then
Text4 = ""
bl = Format(tgl, "mm")
Else
bl = Left(rb!blth, 2)
t = Right(rb!blth, 2)
Text4 = "bulan " & bl & " tahun " & t
If bl = Format(tgl, "mm") And t = Format(tgl, "yy") Then
ket = "LUNAS"
ElseIf Val(bl) < Val(Format(tgl, "mm")) Then
Text5 = Val(Format(tgl, "mm")) - Val(bl)
ket = "kurang " & Text5 & " bulan"
Text6 = Text5
Text7 = Val(Text3) * Val(Text6)
ElseIf Val(t) < Val(Format(tgl, "yy")) Then
Text5 = 12 - Val(Format(tgl, "mm")) + Val(bl)
ket = "kurang " & Text5 & " bulan"
Text6 = Text5
Text7 = Val(Text3) * Val(Text6)
End If
End If
Text6.SetFocus
Else
MsgBox ("NIM tsb TIDAK ADA, ULANGI !!!")
Text1 = ""
Text1.SetFocus
End If
ElseIf Val(Text6) > Val(Text5) Then
Text7 = Val(Text3) * Val(Text6)
End If
End Sub
Private Sub ksg()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
ket = ""
tgl = Format(Now(), ddmmyyyy)
dg.Columns(0).Width = 1500
dg.Columns(1).Width = 1200
dg.Columns(2).Width = 2000
End Sub
No comments:
Post a Comment