Dim kon As New ADODB.Connection
Dim rdel, rsem, rmhs, rmt As Recordset
Dim kg, jk As String
Private Sub Command2_Click()
Set rsem = New ADODB.Recordset
rsem.Open "select * from sem", kon, adOpenKeyset, adLockBatchOptimistic
rsem.AddNew
rsem!kode = tkd
rsem!nama = tma
rsem!sks = tsks
rsem.UpdateBatch adAffectAllChapters
End Sub
Private Sub tkd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Set rmt = New ADODB.Recordset
rmt.Open "select * from mata where kode = '" & Trim(tkd) & "'", kon, adOpenKeyset, adLockReadOnly
If rmt.EOF = False Then
tma = rmt!nama
tsks = rmt!sks
Command2.SetFocus
Else
MsgBox ("Kode Matakuliah tsb GAK ADA")
tkd = ""
tkd.SetFocus
End If
End If
End Sub
Private Sub Form_Load()
konek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\kul.mdb;Persist Security Info=False"
Set kon = New ADODB.Connection
kon.Open konek
kon.CursorLocation = adUseClient
Set rdel = New ADODB.Recordset
rdel.Open "delete from sem", kon, adOpenKeyset, adLockBatchOptimistic
ksg
End Sub
Private Sub ksg()
tak = Format(Now(), "yyyy") & "1"
tnim = ""
tnm = ""
tkd = ""
tma = ""
tsks = ""
jsks = ""
End Sub
Private Sub tnim_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Set rmhs = New ADODB.Recordset
rmhs.Open "select * from mhs where nim = '" & Trim(tnim) & "'", kon, adOpenKeyset, adLockReadOnly
If rmhs.EOF = False Then
tnm = rmhs!nama
tkd.SetFocus
Else
MsgBox ("NIM tsb GAK ADA")
tnim = ""
tnim.SetFocus
End If
End If
End Sub
No comments:
Post a Comment