You are on page 1of 3

Commond 1

IF this.Caption='Tambah Data'
thisform.command2.Enabled= .F.
thisform.command3.Enabled= .F.
this.Caption='Simpan'
thisform.hidup
thisform.kosong
thisform.text1.SetFocus
ELSE
IF EMPTY(thisform.text1.Value)
MESSAGEBOX('Data id poli kosong, data tidak
tersimpan',0+64,'Kosong')
RETURN
ENDIF

*lakukan penambahan record


APPEND BLANK
*simpan data
thisform.simpan
thisform.grdPoli.Refresh

this.Caption='Tambah Data'
thisform.command2.Enabled= .T.
thisform.command3.Enabled= .T.
ENDIF

Commond 2

IF this.Caption='Koreksi Data'
thisform.command1.Enabled= .F.
thisform.command3.Enabled= .F.
this.Caption='Simpan'
thisform.hidup
thisform.kosong
thisform.text1.SetFocus
ELSE
IF EMPTY(thisform.text1.Value)
MESSAGEBOX('Data id poli kosong, data tidak
tersimpan',0+64,'Kosong')
RETURN
ENDIF

*lakukan penambahan record


*APPEND BLANK
*simpan data
thisform.simpan
thisform.grdPoli.Refresh

this.Caption='Tambah Data'
thisform.command1.Enabled= .T.
thisform.command3.Enabled= .T.
ENDIF
Text 1

IF EMPTY(this.Value)
RETURN
ENDIF
IF thisform.command1.Enabled= .T. &&isi data
SEEK ALLTRIM(this.Value) &&cari data
IF FOUND() &&jika ketemu
thisform.tampil
MESSAGEBOX('Data sudah ada',0+64,'Ada')
thisform.kosong
return(.f.)
ELSE &&data tidak ada

ENDIF
ENDIF

IF thisform.command2.Enabled= .T. &&isi koreksi


SEEK ALLTRIM(this.Value) &&cari data
IF FOUND() &&jika ketemu
thisform.tampil
ELSE
MESSAGEBOX('Data tidak ada',0+64,'Tidak Ada')
thisform.kosong
return(.f.)
ENDIF
ENDIF

Form 1

 Kosong

thisform.text1.Value=' '
thisform.text2.Value=' '

 Mati

thisform.text1.Enabled= .F.
thisform.text2.Enabled= .F.

 Tampil

thisform.text1.Value=idpoli
thisform.text2.Value=tupoli

 Simpan

REPLACE idpoli WITH thisform.text1.Value


REPLACE tupoli WITH thisform.text2.Value

 Hidup

thisform.text1.Enabled= .T.
thisform.text2.Enabled= .T.
 Init
* thisform.mati

Simpan

IF SEEK (ALLTRIM(thisform.text1.Value))
MESSAGEBOX('Maaf id poli tersebut sudah ada',0+16,'Peringatan')
RETURN
ENDIF
APPEND BLANK
REPLACE idpoli WITH thisform.text1.Value
REPLACE tupoli WITH thisform.text2.Value
thisform.text1.Value=' '
thisform.text2.Value=' '
thisform.text1.Enabled= .F.
thisform.text2.Enabled= .F.
thisform.command1.Enabled= .F.
thisform.command2.Enabled= .F.
thisform.command3.Enabled= .F.
thisform.command4.Enabled= .F.
thisform.command5.Enabled= .F.
thisform.command1.SetFocus
thisform.Refresh

hapus

DELETE
thisform.text1.Value=' '
thisform.text2.Value=' '
thisform.text1.SetFocus
thisform.grdPoli.Refresh

batal

thisform.text1.Value=' '
thisform.text2.Value=' '

thisform.text1.Enabled= .F.
thisform.text2.Enabled= .F.

thisform.command1.Enabled= .T.
thisform.command2.Enabled= .F.
thisform.command3.Enabled= .F.
thisform.command4.Enabled= .F.
thisform.command5.Enabled= .F.
thisform.command1.SetFocus
thisform.Refresh

You might also like