Terima kasih telah singgah! Semoga kita segera berjumpa lagi

Kamis, 15 Oktober 2015

Belajar Program vb Tampilan awal database mahasiswa



“ Tampilan awal database mahasiswa “

“ Coding database mahasiswa ”

Dim tambah As Boolean

Private Sub Form_Load()

nonaktif

tambah = False

End Sub

Sub nonaktif()

Dim ct1 As Control

For Each ct1 In FormMhs

If TypeName(ct1) = "textboxt" Then

ct1.Locked = True

End If

If TypeName(ct1) = "combobox" Then

ct1.Locked = True

End If

Next

End Sub

Private Sub cmdDel_click()

del = MsgBox("Recor ini dihapus?", 36, "Konfirmasi")

If del = 6 Then

dbMahasiswa.Recordset.Delete

dbMahasiswa.Recordset.MoveNext

If dbMahasiswa.Recordset.EOF Then

dbMahasiswa.Recordset.MoveLast

End If

End If

End Sub

Private Sub CmdEdit_Click()

dbMahasiswa.Recordset.Edit

aktif

End Sub

Private Sub CmdExit_Click()

Unload Me

End Sub

Private Sub CmdFind_Click()

Dim mnamamahasiswa As String * 6

mnamamahasiswa = InputBox("ketik nama mahasiswa:", "Pencarian Data namamahasiswa")

msyarat = " namamahasiswa =" & mnamamahasiswa & ""

dbMahasiswa.Recordset.Index = "namamahasiswa "

dbMahasiswa.Recordset.Seek "=", mnamamahasiswa

If dbMahasiswa.Recordset.NoMatch Then

MsgBox ("Record nama mahasiswa") + cr + "tidak ada", 16, "informasi"

End If

End Sub

Private Sub CmdLast_Click()

dbMahasiswa.Recordset.MoveLast

MsgBox "Sudah di akhir record", 16, "informasi"

End Sub
private Sub CmdNew_Click()

tambah = True

dbMahasiswa.Recordset.AddNew

kosong

aktif

End Sub

Private Sub CmdNext_Click()

dbMahasiswa.Recordset.MoveNext

If dbMahasiswa.Recordset.EOF Then

dbMahasiswa.Recordset.MoveLast

MsgBox "sudah di akhir record", 16, "informasi"

End If

End Sub

Private Sub Cmdprevious_Click()

dbMahasiswa.Recordset.MovePrevious

If dbMahasiswa.Recordset.BOF Then

dbMahasiswa.Recordset.MoveFirst

MsgBox "sudah di awal record", 16, "informasi"

End If

End Sub

Private Sub CmdSave_Click()

If tambah = True Then

dbMahasiswa.Recordset.Update

Else

dbMahasiswa.Recordset.Update

End If

nonaktif

End Sub

Private Sub CmdTop_Click()

dbMahasiswa.Recordset.MoveFirst

MsgBox "sudah di awal record", 16, "informasi"

End Sub




Private Sub CmdUndo_Click()

dbMahasiswa.Recordset.CancelUpdate

dbMahasiswa.Recordset.MoveLast

nonaktif

End Sub

Sub kosong()

Dim ct1 As Control

For Each ct1 In FormMhs

If TypeName(ct1) = "textbox" Then

ct1.Text = ""

End If

If TypeName(ct1) = "combobox" Then

ct1.Text = ""

End If

Next

End Sub

Sub aktif()

Dim ct1 As Control

For Each ct1 In FormMhs

If TypeName(ct1) = "textbox" Then

ct1.Locked = False

End If

If TypeName(ct1) = "combobox" Then

ct1.Locked = False

End If

Next

End Sub

OUTPUT

Tidak ada komentar:

Posting Komentar

If you find any difficulty please comment below .... ^ _ ^