Professional Documents
Culture Documents
Femi
Femi
", vbYesNo + vbInformation, "Konfirmasi") If x = vbYes Then Unload Me End If End Sub Private Sub cmddelet_Click() With dtbuku.Recordset x = MsgBox("Yakin data mau dihapus?", vbYesNo + vbInformation, "Konfirmasi") If x = vbYes Then .Delete .MoveFirst End If End With End Sub Private Sub cmdlast_Click() dtbuku.Recordset.MoveLast End Sub Private Sub cmdNew_Click() aktif bersih Dim i As Integer cmbkode.Enabled = True For i = 2 To 5 teks(i).Enabled = True Next i cmdSave.Enabled = True cmbkode.SetFocus End Sub Private Sub cmdnext_Click() With dtbuku.Recordset .MoveNext If .EOF() Then MsgBox "Data sudah diakhir record", vbOKOnly, "Info" .MoveLast End If End With End Sub Private Sub cmdprev_Click() With dtbuku.Recordset .MovePrevious If .BOF() Then MsgBox "Data sudah diawal record", vbOKOnly, "Info" .MoveFirst End If
End With End Sub Private Sub cmdSave_Click() .AddNew !kode_novel = cmbkode.Text !judul_novel = teks(0).Text !harga = Val(teks(1).Text) !jumlah_beli = Val(teks(2).Text) !total = Val(teks(3).Text) !ubay = Val(teks(4).Text) !ukem = Val(teks(5).Text) .Update End With Form_Activate cmdNew.SetFocus End Sub Private Sub cmdtop_Click() dtbuku.Recordset.MoveFirst End Sub
Private Sub Form_Load() With cmbkode .AddItem ("SP02") .AddItem ("IM03") .AddItem ("HP02") .AddItem ("LP01") End With End Sub Private Sub cmbkode_Click() Select Case cmbkode.Text Case "SP02" teks(0).Text = "Spiderman 2" teks(1).Text = 35000 Case "IM03" teks(0).Text = "Iron Man 3" teks(1).Text = 30000 Case "HP02" teks(0).Text = "Harry Potter 2" teks(1).Text = 45000 Case "LP01" teks(0).Text = "Laskar Pelangi" teks(1).Text = 40000 End Select teks(2).SetFocus End Sub
Private Sub teks_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii = 13 Then If Index = 2 Then If KeyAscii = 13 Then teks(3).Text = Val(teks(2)) * Val(teks(1)) teks(4).SetFocus End If Else If Index = 4 Then teks(5).Text = Val(teks(4)) - Val(teks(3)) cmdSave.SetFocus End If End If End If End Sub
Sub bersih() cmbkode.Text = "" teks(0).Text = "" teks(1).Text = "" teks(2).Text = "" teks(3).Text = "" teks(4).Text = "" teks(5).Text = "" End Sub Sub aktif() cmbkode.Enabled = True teks(0).Enabled = True teks(1).Enabled = True teks(2).Enabled = True teks(3).Enabled = True teks(4).Enabled = True teks(5).Enabled = True End Sub Private Sub Form_Activate() nonaktif cmdSave.Enabled = False End Sub Sub nonaktif() cmbkode.Enabled = False teks(0).Enabled = False
teks(1).Enabled = False teks(2).Enabled = False teks(3).Enabled = False teks(4).Enabled = False teks(5).Enabled = False End Sub
Nama :
Dosen :