VB code sederhana input data

 

 

 

 

 

 

 

 

(1) buat tabel seperti diatas…!!!

ketik code di bawah ini

Private Sub kosongkan()

txtkdkk = “”
txtnmkepkel = “”
txttmplahir = “”
DTPicker1 = Value
cboagama = “”
txtkerjabpk = “”
txtalamat = “”
txtrtrw = “”
txtkota = “”
txtnmibu = “”
txtkerjaibu = “”
txtanaklaki = “”
txtanakprp = “”
txtcari = “”
End Sub

Private Sub cmdclear_Click()
kosongkan
End Sub

Private Sub cmdkeluar_Click()
End
End Sub

Private Sub cmdview_Click()
Form2.Show
End Sub

Private Sub cmdsimpan_Click()
With Form2.Adodc1.Recordset
.AddNew
!kd_kk = txtkdkk
!nm_kepkel = txtnmkepkel
!tmp_lahir = txttmplahir
!tgl_lahir = DTPicker1
!agama = cboagama
!pekerjaan = txtkerjabpk
!alamat = txtalamat
!rt_rw = txtrtrw
!kota = txtkota
!nm_ibu = txtnmibu
!pekerjaan_ibu = txtkerjaibu
!jml_anaklaki = txtanaklaki
!jml_anakperempuan = txtanakprp
.Update
Form2.DataGrid1.Refresh
End With
kosongkan
End Sub

Private Sub cmdcari_Click()
Dim cari As String * 20
cari = txtcari.Text
Form2.Adodc1.Recordset.MoveFirst
Form2.Adodc1.Recordset.Find “kd_kk = ‘” & cari & “‘”
If Form2.Adodc1.Recordset.EOF Then
pesan = MsgBox(“Kode KK tidak ada..”, vbOKOnly, “Pesan Program”)
Form2.Adodc1.Recordset.MoveFirst
Else
txtkdkk.Text = Form2.Adodc1.Recordset.Fields(“kd_kk”)
txtnmkepkel.Text = Form2.Adodc1.Recordset.Fields(“nm_kepkel”)
txtkerjabpk.Text = Form2.Adodc1.Recordset.Fields(“pekerjaan”)
txttmplahir.Text = Form2.Adodc1.Recordset.Fields(“tmp_lahir”)
DTPicker1.Value = Form2.Adodc1.Recordset.Fields(“tgl_lahir”)
cboagama.Text = Form2.Adodc1.Recordset.Fields(“agama”)
txtalamat.Text = Form2.Adodc1.Recordset.Fields(“alamat”)
txtrtrw.Text = Form2.Adodc1.Recordset.Fields(“rt_rw”)
txtkota.Text = Form2.Adodc1.Recordset.Fields(“kota”)
txtnmibu.Text = Form2.Adodc1.Recordset.Fields(“nm_ibu”)
txtkerjaibu.Text = Form2.Adodc1.Recordset.Fields(“pekerjaan_ibu”)
txtanaklaki.Text = Form2.Adodc1.Recordset.Fields(“jml_anaklaki”)
txtanakprp.Text = Form2.Adodc1.Recordset.Fields(“jml_anakperempuan”)
Form2.Show
txtcari.Text = “”
End If
End Sub

Private Sub Form_Load()
cboagama.AddItem “Buddha”
cboagama.AddItem “Hindhu”
cboagama.AddItem “Islam”
cboagama.AddItem “Katolik”
cboagama.AddItem “Kristen”
End Sub

 

 

 

 

 

 

 

Private Sub cmdback_Click()
Form1.Show
Form2.Visible = False
End Sub

Private Sub cmdhapus_Click()
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
Adodc1.Recordset.MoveFirst
Form1.txtkdkk = “”
Form1.txtnmkepkel = “”
Form1.txttmplahir = “”
Form1.DTPicker1 = Value
Form1.cboagama = “”
Form1.txtkerjabpk = “”
Form1.txtrtrw = “”
Form1.txtalamat = “”
Form1.txtkota = “”
Form1.txtnmibu = “”
Form1.txtkerjaibu = “”
Form1.txtanaklaki = “”
Form1.txtanakprp = “”
End Sub

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s