Untuk
mengaktifkan form
Private Sub FORM_ACTIVE()
With Adodc1
.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist
Security Info=False;Initial
Catalog=APLIKASI_CUSTOMER_SERVICE;Data
Source=NINA"
.CommandType = adCmdTable
.RecordSource = "SELECT * FROM POLI"
End With
End Sub
Program dibawah
ini adalah untuk listing menutup windows dengan menampilkan message box apakah
anda mau menyimpan atau tidak.
Jika ya akan keluar dan menyimpan ditabel
Jika tidak membatalkan input kedalam table.
Private Sub Command7_Click()
If MsgBox("ANDA AKAN MENYIMPAN DATA?",
vbYesNo) = vbYes Then
Unload Me
Else: Adodc1.Recordset.CancelBatch
End If
Unload Me
End Sub
Listing untuk
menambahkan
Private Sub Command1_Click()
Adodc1.Refresh
Adodc1.Recordset.AddNew
Text1.SetFocus
End Sub
Listing
Untuk menyimpan
Private Sub Command2_Click()
Adodc1.Recordset.Save
Command1.SetFocus
End Sub
Jika
melibatkan 2 tabel maka kodingan untuk
menyimpan
Private Sub Command2_Click()
Adodc2.Recordset![TANGGAL PEMBAYARAN] = Text1.Text
Adodc2.Recordset![NO PEMBAYARAN] = Text2.Text
Adodc2.Recordset![NO MRP] = Adodc3.Recordset![NO MRP]
Adodc2.Recordset![POTONGAN] = Text6.Text
Adodc2.Recordset![KODE DOKTER] = Adodc1.Recordset![KODE
DOKTER]
Adodc2.Recordset![KODE POLI] = Adodc4.Recordset![KODE POLI]
Adodc2.Recordset![PEMBAYARAN SEBELUM POTONGAN] =
Adodc4.Recordset![HARGA JASA]
Adodc2.Recordset![HARGA POTONGAN] = Text12.Text
Adodc2.Recordset![PEMBAYARAN SESUDAH POTONGAN] = Text13.Text
Adodc2.Recordset![DIBAYAR] = Text14.Text
Adodc2.Recordset![KEMBALIAN] = Text15.Text
Command1.SetFocus
End Sub
Listing
Untuk mencari
Private Sub Command8_Click()
Adodc1.Recordset.Find "[NAMA DEPAN]= '" &
Text21.Text & "'"
Adodc1.Recordset.Filter = "[NAMA DEPAN] LIKE '"
& Text21.Text & "'"
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
End If
Text22.SetFocus
End Sub
Listing Program untuk mencari jumlah umur
sekarang
Private Sub Text5_KEYPRESS(KEYASCII As Integer)
If Not KEYASCII = 13 Then
Exit Sub
End If
Text5.Text = Format(Text5.Text, "DD/MM/YY")
Text6.SetFocus
End Sub
Private Sub Text6_KEYPRESS(KEYASCII As Integer)
If Not KEYASCII = 13 Then
Exit Sub
End If
Text6.Text = Format(Date, "YYYY") -
Format(Text5.Text, "YYYY")
Text7.SetFocus
End Sub
Atau
Private Sub Text5_KEYPRESS(KEYASCII As Integer)
If Not KEYASCII = 13 Then
Exit Sub
End If
Dim awal
Dim akhir
Dim hasil
akhir = Year(Text4.Text)
awal = Format(Date, "yyyy")
hasil = awal - akhir
Text5.Text = hasil
Text6.SetFocus
End Sub
Listing Program If Then
Else untuk Pilihan dengan menginput nilai 1,2
Private Sub Text9_KeyPress(KEYASCII As Integer)
If Not KEYASCII = 13 Then
Exit Sub
End If
If Val(Text9.Text) = 1 Then
Text9.Text = "SINGLE"
ElseIf Val(Text9.Text) = 2 Then
Text9.Text = "KAWIN"
Else
Text9.Text = "-"
End If
Text10.SetFocus
End Sub
Untuk mengetahui data dengan memanggil kodenya
Private Sub Text9_KeyPress(KEYASCII As Integer)
If Not KEYASCII = 13 Then
Exit Sub
End If
Adodc4.Recordset.MoveFirst
Adodc4.Recordset.Find "[KODE POLI]='" & Text9.Text
& "'"
If Adodc1.Recordset.EOF Then
MsgBox "KODE DOKTER SALAH!"
Text9.Text = ""
Else
Text10.Text = Adodc4.Recordset![NAMA POLI]
Text11.Text = Adodc4.Recordset![HARGA JASA]
End If
Text12.SetFocus
End Sub
No comments:
Post a Comment