Anda di halaman 1dari 3

VALIDASI

Buatlah program meng-entry data kamar ke dalam tabel kamar dengan validasi terhadap Nomor Kamar.
Jika Nomor Kamar telah ada di tabel, tampilkan pesan “Data Telah Ada”.
Jika No Kamar belum ada di tabel, tampil pesan ”Data Belum Ada. Ingin Input?”
Jika ingin entry, maka form siap untuk diisi. Form akan kembali ke tampilan awal setelah data kamar
di-entry.
Jika tidak ingin entry, maka form akan kembali ke tampilan awal.

tno
Properties
Max Length 4

ttipe
Properties
Max Length 15

tlantai
Properties
Max Length 2
tlokasi
Properties
Max Length 30

costatus
Properties
Row Source Kosong,Terisi
Row Source Type Value
Style Dropdown List

tharga
Properties
Input Mask 9999999

gkamar
Properties
Read Only True
Record Sourcekamar

form
Procedure Load
close tables all
use “e:\kamar”
set order to tag no

form + ccancel
Procedure Activate + Click
With thisform

.tno.value = ' '


.ttipe.value = ' '
.tlantai.value = ' '
.tlokasi.value = ' '
.costatus.listindex = 0
.tharga.value = ' '
.tno.setfocus

endwith
tno
Procedure LostFocus
With thisform

IF EMPTY (.tno.value)
.tno.setfocus
ELSE
SEEK alltrim (.tno.value)
IF FOUND()
MESSAGEBOX("Data telah ada",48,"Info")
.tno.value = ' '
.tno.setfocus
ENDIF
ENDIF

endwtih

csave
Procedure Click
With thisform

APPEND BLANK
replace no WITH .tno.value
replace tipe WITH .ttipe.value
replace lantai WITH .tlantai.value
replace lokasi WITH .tlokasi.value

IF .costatus.displayvalue = 'Terisi'
replace status WITH 'Terisi'
ELSE
IF .costatus.displayvalue = 'Terisi'
replace status WITH 'Kosong'
ENDIF
endi

replace harga WITH VAL(.tharga.value)

.gkamar.refresh
.ccancel.click

endwith

Anda mungkin juga menyukai