0% found this document useful (0 votes)
133 views5 pages

Database: 2. Buatlah Database Dengan Nama Datakhs - MDB

The document describes creating a database project named KHS with a datakhs.mdb database. It includes creating a Mahasiswa table with fields for Name, Nim, Nama, Jur, Jnskel, Almt, and Telp. It also describes designing a form named Frmmhs to display, add, edit, delete and search student records from the Mahasiswa table using controls like text boxes, combo boxes and command buttons. Procedures are written to activate, deactivate and clear form controls, display student data, add new records, save, find, navigate and close records.

Uploaded by

Rambo John
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
133 views5 pages

Database: 2. Buatlah Database Dengan Nama Datakhs - MDB

The document describes creating a database project named KHS with a datakhs.mdb database. It includes creating a Mahasiswa table with fields for Name, Nim, Nama, Jur, Jnskel, Almt, and Telp. It also describes designing a form named Frmmhs to display, add, edit, delete and search student records from the Mahasiswa table using controls like text boxes, combo boxes and command buttons. Procedures are written to activate, deactivate and clear form controls, display student data, add new records, save, find, navigate and close records.

Uploaded by

Rambo John
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DATABASE

1. Buatlah project dengan nama KHS 2. Buatlah database dengan nama datakhs.mdb 3. Buatlah tabel dengan struktur sbb : Tabel : Mahasiswa Name Nim Nama Jur Jnskel Almt Telp
Rancangan Form Sbb : Frmmhs

Type Text Text Text Text Text Text

Size 8 20 2 1 25 15

Index Primary Key

1. Data (Propertise) Name Database Name Recordset Type Recordsource 2. DBGrid (Propertise) Name DataSource 3. Timer (Propertise) Interval Listing Form Mahasiswa Sub aktif() txtnama.Enabled = True cmbjur.Enabled = True txtalmt.Enabled = True cmbjen.Enabled = True txttelp.Enabled = True End Sub Sub nonaktif() txtnim.Enabled = False txtnama.Enabled = False cmbjur.Enabled = False txtalmt.Enabled = False cmbjen.Enabled = False txttelp.Enabled = False End Sub Sub kosong() txtnama = "" cmbjur = "" txtalmt = "" cmbjen = "" txttelp = "" End Sub

: : : :

dtmahasiswa KHS.mdb 0 Table mahasiswa

: dbgrid1 : dtmahasiswa : 25

Unload Me End If End Sub Private Sub cmdedit_Click() aktif txtnim.Enabled = False cmdsave.Enabled = True End Sub

Sub tampildata() On Error GoTo error With dtmahasiswa.Recordset txtnim.Text = !nim txtnama.Text = !nama cmbjur = !jur txtalmt.Text = !almt cmbjen = !jnskel txttelp.Text = !telp End With error: End Sub Private Sub cmdback_Click() With dtmahasiswa.Recordset .MovePrevious If .BOF() Then .MoveFirst

Private Sub cmdexit_Click() x = MsgBox("apakah anda mau keluar?", vbYesNo + vbInformation, "Info") If x = vbYes Then

MsgBox "Sudah diawal record", vbOKOnly + vbInformation, "Info" End If End With tampildata End Sub Private Sub cmddel_Click() x = MsgBox("Yakin data mau dihapus", vbYesNo + vbInformation, "Info") If x = vbYes Then With dtmahasiswa.Recordset .Delete .MoveFirst End With MsgBox "Data Berhasil dihapus", vbOKOnly + vbInformation, "Info'" End If tampildata End Sub

tampildata End Sub Private Sub cmdnew_Click() Dim Kode As String Dim kd As Integer With dtmahasiswa.Recordset If .EOF Then Kode = "1207" & "001" Else .MoveLast kd = Val(Right(!nim, 3)) + 1 Kode = "1207" & Right("000" & kd, 3) End If End With aktif txtnim.Text = Kode txtnama.SetFocus cmdsave.Enabled = True cmdnew.Enabled = False kosong End Sub Private Sub cmdnext_Click() With dtmahasiswa.Recordset .MoveNext If .EOF() Then .MoveLast MsgBox "Sudah diakhir record", vbOKOnly + vbInformation, "Info" End If End With tampildata End Sub Private Sub cmdsave_Click() With dtmahasiswa.Recordset x = txtnim.Text .Index = "nim" .Seek "=", x If .NoMatch Then .AddNew

Private Sub cmdfind_Click() With dtmahasiswa.Recordset x = txtcari.Text .Index = "nim" .Seek "=", x If .NoMatch Then MsgBox "Maaf data tidak ada", vbOKOnly + vbExclamation, "Info" txtcari = "" txtcari.SetFocus Else tampildata End If End With nonaktif End Sub Private Sub cmdlast_Click() dtmahasiswa.Recordset.MoveLast

!nim = txtnim.Text !nama = txtnama.Text !jur = cmbjur !almt = txtalmt.Text !jnskel = cmbjen !telp = txttelp.Text .Update Else .Edit !nim = txtnim.Text !nama = txtnama.Text tampildata cmdsave.Enabled = False cmdnew.Enabled = True End Sub Private Sub cmdtop_Click() dtmahasiswa.Recordset.MoveFirst tampildata End Sub Private Sub Form_Activate() On Error GoTo error nonaktif tampildata cmdsave.Enabled = False error: End Sub Private Sub Form_Load() With cmbjur .AddItem "KA"

!jur = cmbjur !almt = txtalmt.Text !jnskel = cmbjen !telp = txttelp.Text .Update End If End With MsgBox "Data berhasil disimpan", vbOKOnly + vbInformation, "Info" nonaktif .AddItem "MI" .AddItem "TK" End With With cmbjen .AddItem "P" .AddItem "W" End With End Sub Private Sub cmdclose() End End Sub Private Sub Timer1_Timer() Static A A = A + 10: If A > 500 Then A = 0 Label1.ForeColor = RGB(0, Abs(A 25), 0) End Sub

You might also like