Minggu, 14 Juni 2009

listening entri pembayaran

ENTRI PEMBAYARAN

Kode Program :
Private Sub Cmdbatal_Click()
Kosong
End Sub

Private Sub Cmdcari_Click()
If Txtnopeserta.Text = "" Then
MsgBox "No Peserta belum diinputkan..", vbInformation, "Pesan"
Txtnopeserta.SetFocus
Else
With Data1.Recordset
.Index = "idxpeserta"
.Seek "=", Txtnopeserta.Text
If Not .NoMatch Then
If !sisaangsuran = 0 Then
MsgBox "Peserta ini sudah lunas..", vbInformation, "Pesan"
Kosong
TxtNobayar.SetFocus
Else
TxtNama.Text = !nama
Txtbiaya.Text = !biayakursus
Txtsisa.Text = !sisaangsuran
Data2.Recordset.Index = "idxkursus"
Data2.Recordset.Seek "=", !kode_kursus
If Not Data2.Recordset.NoMatch Then
Txtnamakursus.Text = Data2.Recordset!nama_Kursus
End If
Txtcicilanke.Text = Val(!cicilanke) + 1
TxtJumlahbayar.SetFocus
End If
Else
MsgBox "No Peserta tidak ada..", vbInformation, "Pesan"
Txtnopeserta.Text = ""
Txtnopeserta.SetFocus
End If
End With
End If
End Sub

Private Sub CmdKeluar_Click()
Unload Me
End Sub
Private Sub Kosong()
Dim obj As Object
For Each obj In Controls
If Left(obj.Name, 3) = "Txt" Then obj.Text = ""
If Left(obj.Name, 3) = "cbo" Then obj.ListIndex = -1
Next
End Sub

Private Sub Cmdsimpan_Click()
If TxtNobayar.Text = "" Then
MsgBox "No pembayaran belum diisi..", vbInformation, "Pesan"
TxtNobayar.SetFocus
Else
X = MsgBox("Data sudah benar ?", vbYesNo, "simpan data")
If X = vbYes Then
simpanbayar
updatepeserta
Kosong
End If
End If
End Sub
Private Sub simpanbayar()
With Data3.Recordset
.AddNew
!nobayar = TxtNobayar.Text
!tglbayar = Dtptgl.Value
!nopeserta = Txtnopeserta.Text
!jumlahbayar = TxtJumlahbayar.Text
!cicilanke = Txtcicilanke.Text
.Update
End With
End Sub
Private Sub updatepeserta()
With Data1.Recordset
.Edit
!sisaangsuran = Val(Txtsisaberikut.Text)
!cicilanke = Val(Txtcicilanke.Text)
.Update
End With
End Sub

Private Sub Cmdtambah_Click()
Kosong
TxtNobayar.SetFocus
End Sub

Private Sub Form_Load()
Kosong
End Sub

Private Sub TxtJumlahbayar_LostFocus()
Txtsisaberikut.Text = Val(Txtsisa.Text) - Val(TxtJumlahbayar.Text)

End Sub

Private Sub TxtNobayar_LostFocus()
If TxtNobayar.Text <> "" Then
With Data3.Recordset
.Index = "idxbayar"
.Seek "=", TxtNobayar.Text
If Not .NoMatch Then
MsgBox "Nomor pembayaran ini sudah ada..", vbInformation, "Pesan"
TxtNobayar.Text = ""
TxtNobayar.SetFocus
End If
End With
End If
End Sub

Tidak ada komentar:

Poskan Komentar