Sebenarnya gue dapet ilmu ini dari skul juga seh...
hehehehe...
Ne scripnya...
TABEL PROPERTIES | |||
object | properties | setting | |
label1 | caption | kode barang | |
label2 | caption | nama barang | |
label3 | caption | harga | |
label4 | caption | jumlah harga | |
label5 | caption | total awal | |
label6 | caption | keterangan | |
label7 | caption | diskon | |
label8 | caption | total akhir | |
text box1 | name | txtkode | |
onlostfocus | Private Sub txtkode_LostFocus() | ||
If txtkode = "1" Then | |||
txtnama = "pensil" | |||
txtharga = "1000" | |||
ElseIf txtkode = "2" Then | |||
txtnama = "polpen" | |||
txtharga = "1500" | |||
ElseIf txtkode = "3" Then | |||
txtnama = "tipe x" | |||
txtharga = "2000" | |||
ElseIf txtkode = "4" Then | |||
txtnama = "buku" | |||
txtharga = "1250" | |||
ElseIf txtkode = "5" Then | |||
txtnama = "penggaris" | |||
txtharga = "1350" | |||
ElseIf txtkode = "6" Then | |||
txtnama = "penghapus" | |||
txtharga = "2000" | |||
Else | |||
MsgBox ("pintar") | |||
txtkode.SetFocus | |||
End If | |||
End Sub | |||
text box2 | name | txtnama | |
text box3 | name | txtharga | |
text box4 | name | txtjumlah | |
onlostfocus | Private Sub txtjumlah_LostFocus() | ||
Dim a, b, c, d As Double | |||
If txtawal >= "100000" Then | |||
txtketerangan = "diskon sebesar 15%" | |||
txtdiskon = "15%" | |||
b = txtharga | |||
c = txtjumlah | |||
a = c * b | |||
txtawal = a | |||
d = a - (a * 15 / 100) | |||
txtakhir = d | |||
Else | |||
txtketerangan = "anda tidak mendapat diskon" | |||
txtdiskon = "0%" | |||
b = txtharga | |||
c = txtjumlah | |||
a = b * c | |||
txtawal = a | |||
d = a | |||
txtakhir = d | |||
End If | |||
End Sub | |||
text box5 | name | txtawal | |
text box6 | name | txtketerangan | |
text box7 | name | txtdiskon | |
text box8 | name | txtakhir | |
command button1 | name | cmdbatal | |
caption | batal | ||
command button2 | name | cmdhapus | |
caption | hapus | ||
onclick | Private Sub cmdhapus_Click() | ||
txtkode = "" | |||
txtnama = "" | |||
txtharga = "" | |||
txtjumlah = "" | |||
txtawal = "" | |||
txtdiskon = "" | |||
txtakhir = "" | |||
txtketerangan = "" | |||
txtkode.SetFocus | |||
End Sub | |||
command button3 | name | cmdkeluar | |
caption | keluar | ||
onclick | Private Sub cmdclose_Click() | ||
DoCmd.Close | |||
End Sub |
0 komentar:
Posting Komentar