Change Your Avatar --------------> admin
Rank : Admin
My Pets : Jumlah posting : 550 Point : 2147483647 Reputasi : 47 Join date : 2010-04-23 Age : 31 Lokasi : indonesia
| Subject: Update Aplikasi Database Mahasiswa VB6 Wed 04 Aug 2010, 17:03 | |
| - Code:
-
Private Sub cmdcari_Click() If txtcari3.Text = "" Then MsgBox "NRP Tidak boleh kosong", vbCritical, salah txtcari3.SetFocus Else Set rs = New ADODB.Recordset rs.Open "SELECT * FROM Mahasiswa WHERE NRP ='" + txtcari3.Text + "'", con If Not rs.EOF Then txtdt1 = rs("NRP") txtdt2 = rs("Nama") txtdt3 = rs("Kelas") Else MsgBox "Nrp tidak ada", vbCritical, salah End If End If End Sub
Private Sub cmdclear_Click() txtnrp.Text = "" txtnama.Text = "" txttugas.Text = "" txtquiz.Text = "" txtuts.Text = "" txtuas.Text = "" txtakhir.Text = "" cmb1.Text = "" cmb2.Text = "" cmb3.Text = "" List1.Clear Combo1.Text = "Pilih Matakuliah" txtnrp.Enabled = False txtnama.Enabled = False txttugas.Enabled = False txtquiz.Enabled = False txtuts.Enabled = False txtuas.Enabled = False cmdclear.Enabled = False cmdsimpan.Enabled = False cmdproses.Enabled = False cmdclearlist.Enabled = False Combo1.Text = "Pilih Matakuliah" cmdtambah.Enabled = False cmb1.Enabled = False cmb2.Enabled = False cmb3.Enabled = False Combo1.Enabled = True cmdtambah.Enabled = False
End Sub
Private Sub cmdclearlist_Click() List1.Clear End Sub
Private Sub cmddjrs_Click()
X = App.Path & "\kelas.txt" Open X For Output As #2
Print #2, Data
Close #2 MsgBox "Semua Jurusan / konsentrasi di hapus", vbInformation, benar cmb2.Clear cmb5.Clear MsgBox "Silahkan Tambah Jurusan", vbInformation, benar End Sub
Private Sub Combo3_click() Set rs = New ADODB.Recordset rs.Open "SELECT * FROM Mahasiswa WHERE NRP + MataKuliah ='" + txtcari3.Text + Combo3 + "'", con If Not rs.EOF Then Text1 = rs("Tugas") Text2 = rs("Quiz") Text3 = rs("UTS") Text4 = rs("UAS") Text5 = rs("Nilai Akhir") Else MsgBox "Untuk NRP ini Nilai MataKuliah Tidak ada", vbCritical, salah MsgBox "Input Terlebih dahulu", vbCritical, salah Combo3.Text = "Pilih MataKuliah" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" End If End Sub
Private Sub Combo4_click() If Combo4.Text = "Pilih MataKuliah" Then txtcari2.Enabled = False Else txtcari2.Enabled = True End If
End Sub
Private Sub Command1_Click()
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM Register WHERE Nama + Password ='" + Text7.Text + Text10.Text + "'", con If Not rs.EOF Then Set rs = New ADODB.Recordset rs.Open "SELECT * FROM Mahasiswa WHERE NRP + MataKuliah ='" + txtcari.Text + Combo2.Text + "'", con If Not rs.EOF Then con.Execute "DELETE * from Mahasiswa WHERE NRP + MataKuliah ='" + txtcari.Text + Combo2.Text + "'" MsgBox "Data Terhapus", vbInformation, Delete tampil txtcari.Text = "" Combo2.Text = "Pilih MataKuliah" Else MsgBox "Data Tidak Sesuai", vbCritical, salah MsgBox "Tentukan NRP dan MataKuliah (Harus Sesuai)", vbCritical, salah End If Else MsgBox "Anda Belum Register", vbCritical, salah SSTab1.Tab = 5 Frame13.Visible = True MsgBox "Silahkan Register Terlebih Dahulu", vbCritical, salah End If
End Sub
Private Sub Command10_Click() MsgBox "Data Telah Di simpan", vbInformation, simpan txtcari2.Text = "" txtnamabr.Text = "" txtnrpbr.Text = "" cmb4.Text = "" cmb5.Text = "" cmb6.Text = "" Combo4.Text = "Pilih MataKuliah" Command2.Enabled = False txtnamabr.Enabled = False Command3.Enabled = False txtnrpbr.Enabled = False Command4.Enabled = False cmb4.Enabled = False cmb5.Enabled = False cmb6.Enabled = False ednama.Enabled = False ednrp.Enabled = False edkelas.Enabled = False Command10.Enabled = False txtcari2.Enabled = True SSTab1.Tab = 1 End Sub
Private Sub Command11_Click() If Text7.Text = "" Then MsgBox "User Tidak boleh kosong", vbCritical, salah Text7.SetFocus ElseIf Text10.Text = "" Then MsgBox "Password Tidak boleh kosong", vbCritical, salah Text10.SetFocus Else Set rs = New ADODB.Recordset rs.Open "SELECT * FROM Register WHERE Nama + Password ='" + Text7.Text + Text10.Text + "'", con If Not rs.EOF Then MsgBox "Password Succes", vbInformation, succes Text7.Locked = True Text7.Enabled = False Combo4.Enabled = True tmbdata.Enabled = True tmbjrs.Enabled = True Command6.Enabled = True Command7.Enabled = True Command8.Enabled = True Command9.Enabled = True cmddjrs.Enabled = True Command11.Enabled = False Frame11.Visible = True Frame13.Visible = False Frame12.Visible = True Command13.Visible = False Frame14.Visible = False Command16.Visible = False cmdsimpan.Enabled = True Command19.Visible = False For a = 4 To 0 Step -1 SSTab1.Tab = a Next a Else MsgBox "User Dan Password Berbeda", vbCritical, salah End If End If End Sub
Private Sub Command12_Click()
If MsgBox("Anda yakin mau logout ?", vbQuestion + vbYesNo) = vbNo Then Cancel = 1 Else Text7.Text = "" Text10.Text = "" Frame13.Visible = True Text7.Locked = False Text7.Enabled = True Combo4.Enabled = False tmbdata.Enabled = False tmbjrs.Enabled = False Command6.Enabled = False Command7.Enabled = False Command8.Enabled = False Command9.Enabled = False cmddjrs.Enabled = False Command11.Enabled = True Frame11.Visible = False Frame12.Visible = False Label16.Visible = False Command13.Visible = True Frame14.Visible = False Command16.Visible = True Command19.Visible = True cmdsimpan.Enabled = False MsgBox "Thank you" Text7.SetFocus txtcari2.Text = "" txtcari3.Text = "" txtdt1.Text = "" txtdt2.Text = "" txtdt3.Text = "" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Combo3.Text = "Pilih MataKuliah" txtcari2.Text = "" txtnamabr.Text = "" txtnrpbr.Text = "" cmb4.Text = "" cmb5.Text = "" cmb6.Text = "" Combo4.Text = "Pilih MataKuliah" Command2.Enabled = False txtnamabr.Enabled = False Command3.Enabled = False txtnrpbr.Enabled = False Command4.Enabled = False cmb4.Enabled = False cmb5.Enabled = False cmb6.Enabled = False ednama.Enabled = False ednrp.Enabled = False edkelas.Enabled = False Command10.Enabled = False txtcari2.Enabled = True COVER.BackColor = &H800000 End If End Sub
Private Sub Command13_Click() Frame14.Visible = True Command13.Visible = False Text8.Text = "" Frame13.Visible = False Command16.Visible = False End Sub
Private Sub Command14_Click()
If Text6.Text = "" Then MsgBox "Isi User", vbCritical, salah Text6.SetFocus ElseIf Text9.Text = "" Then MsgBox "Isi Email", vbCritical, salah Text9.SetFocus ElseIf Text8.Text = "" Then MsgBox "Isi Password ", vbCritical, salah Text8.SetFocus ElseIf Text14.Text = "" Then MsgBox "Isi Password ", vbCritical, salah Text14.SetFocus Else If Text8.Text = Text14 Then con.Execute "insert into Register values('" & Text6.Text & "','" & Text9.Text & "','" & Text8.Text & " ')" MsgBox "Data anda Telah kami simpan silahkan keluar", vbInformation, simpan Label16.Visible = True Label24.Visible = True Text8.ForeColor = vbBlack Text14.ForeColor = vbBlack Else Text8.ForeColor = vbRed Text14.ForeColor = vbRed MsgBox "Password Berbeda", vbCritical, salah Text8.SetFocus End If End If End Sub
Private Sub Command15_Click() Frame13.Visible = True Frame14.Visible = False Command13.Visible = True Command16.Visible = True Text6.Text = "" Text8.Text = "" Text9.Text = "" Label16.Visible = False Label24.Visible = False End Sub
Private Sub Command16_Click() Frame16.Visible = True Frame13.Visible = False Frame14.Visible = False Command13.Visible = False Command16.Visible = False End Sub
Private Sub Command17_Click() Set rs = New ADODB.Recordset rs.Open "SELECT * FROM Register WHERE Nama + Email ='" + Text12.Text + Text11.Text + "'", con If Not rs.EOF Then Text13.Text = rs("Password") Else MsgBox "Data Tidak ada", vbCritical, salah MsgBox "Atau Mungkin User atau Email Tidak terdaftar", vbCritical, salah End If End Sub
Private Sub Command18_Click() Frame16.Visible = False Frame13.Visible = True Command13.Visible = True Text11.Text = "" Text12.Text = "" Text13.Text = "" Command16.Visible = True End Sub
Private Sub Command19_Click() SSTab1.Tab = 5 Frame13.Visible = True Command13.Visible = True Command16.Visible = True End Sub
Private Sub Command2_Click() If txtnamabr.Text = "" Then MsgBox "Isi Nama Baru", vbCritical, salah Else If MsgBox("Anda yakin mau merubah nama?", vbQuestion + vbYesNo) = vbNo Then Cancel = 1 Else con.Execute " UPDATE Mahasiswa Set Nama ='" + txtnamabr.Text + "' WHERE NRP='" + txtcari2.Text + "'" MsgBox "Nama di dataBase Telah Berubah", vbInformation, simpan tampil txtnamabr.Text = "" Command2.Enabled = False txtnamabr.Enabled = False Command3.Enabled = False txtnrpbr.Enabled = False Command4.Enabled = False cmb4.Enabled = False cmb5.Enabled = False cmb6.Enabled = False txtcari2.Enabled = True End If End If End Sub
Private Sub Command20_Click() On Error Resume Next cd.ShowColor COVER.BackColor = cd.Color End Sub
Private Sub Command3_Click() If txtnrpbr.Text = "" Then MsgBox "Isi NRP baru", vbCritical, salah Else If MsgBox("Anda Yakin Mau Merubah NRP?", vbQuestion + vbYesNo) = vbNo Then Cancel = 1 Else con.Execute " UPDATE Mahasiswa Set NRP ='" + txtnrpbr.Text + "' WHERE NRP='" + txtcari2.Text + "'" tampil MsgBox "NRP Telah di Ubah ", vbInformation, simpan MsgBox "Silahkan Masukan NRP yang baru Perintah cari Untuk Melanjutkan EDITING" txtcari2.Text = "" txtnrpbr.Text = "" Command2.Enabled = False txtnamabr.Enabled = False Command3.Enabled = False txtnrpbr.Enabled = False Command4.Enabled = False cmb4.Enabled = False cmb5.Enabled = False cmb6.Enabled = False ednama.Enabled = False ednrp.Enabled = False edkelas.Enabled = False txtcari2.Enabled = True End If End If End Sub
Private Sub Command4_Click() If cmb4.Text = "" And cmb5.Text = "" And cmb6.Text = "" Then MsgBox "Pilihan Kelas Harus penuh ", vbCritical, salah ElseIf cmb4.Text = "" Then MsgBox "Isi Kelas", vbCritical, salah cmb4.SetFocus ElseIf IsNumeric(cmb4) = False Then MsgBox "Kelas harus angka", vbCritical, salah cmb4.SetFocus ElseIf cmb4 > 3 Then MsgBox " kelas tidak lebih dari 3", vbCritical, salah cmb4.SetFocus ElseIf cmb5.Text = "" Then MsgBox "Isi Jurusan", vbCritical, salah MsgBox "Atau Silahkan Tambah Jurusan Di Menu Tambah Input Data", vbCritical, salah ElseIf cmb6.Text = "" Then MsgBox "Isi Kelas", vbCritical, salah cmb6.SetFocus ElseIf IsNumeric(cmb6) = False Then MsgBox "Kelas harus angka", vbCritical, salah cmb6.SetFocus ElseIf cmb6 > 10 Then MsgBox " kelas jurusan tidak lebih dari 10", vbCritical, salah cmb6.SetFocus Else If MsgBox("Anda Yakin Mau merubah Kelas?", vbQuestion + vbYesNo) = vbNo Then Cancel = 1 Else con.Execute " UPDATE Mahasiswa Set Kelas ='" + cmb4 + " " + cmb5 + " - " + cmb6 + "' WHERE NRP='" + txtcari2.Text + "'" MsgBox "Data di Database telah berubah" tampil cmb4.Text = "" cmb5.Text = "" cmb6.Text = "" Command2.Enabled = False txtnamabr.Enabled = False Command3.Enabled = False txtnrpbr.Enabled = False Command4.Enabled = False cmb4.Enabled = False cmb5.Enabled = False cmb6.Enabled = False txtcari2.Enabled = True End If End If End Sub
Private Sub Command5_Click() txtcari3.Text = "" txtdt1.Text = "" txtdt2.Text = "" txtdt3.Text = "" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Combo3.Text = "Pilih MataKuliah" MsgBox "Data Sudah Bersih" End Sub
Private Sub Command6_Click() COVER.BackColor = vbBlack SSTab1.BackColor = vbBlack End Sub
Private Sub Command7_Click() COVER.BackColor = &H800000 SSTab1.BackColor = &H800000 End Sub
Private Sub Command8_Click() COVER.BackColor = vbRed SSTab1.BackColor = vbRed End Sub
Private Sub Command9_Click() COVER.BackColor = vbGreen SSTab1.BackColor = vbGreen End Sub
Private Sub edkelas_Click() Command4.Enabled = True cmb4.Enabled = True cmb5.Enabled = True cmb6.Enabled = True End Sub
Private Sub ednama_Click() Command2.Enabled = True txtnamabr.Enabled = True End Sub
Private Sub ednrp_Click() Command3.Enabled = True txtnrpbr.Enabled = True End Sub Private Sub form_Unload(Cancel As Integer) If MsgBox("Yakin mau keluar?", vbQuestion + vbYesNo) = vbNo Then Cancel = 1 End If End Sub Private Sub cmdexit_Click() Unload Me End Sub
Private Sub cmdproses_Click()
If txttugas.Text = "" Then MsgBox "Isi Nilai tugas", vbCritical, salah txttugas.SetFocus ElseIf IsNumeric(txttugas.Text) = False Then MsgBox "Nilai tugas Harus Angka", vbCritical, salah txttugas.SetFocus ElseIf txttugas > 100 Then MsgBox "Nilai Tidak lebih dari 100", vbCritical, salah txttugas.SetFocus ElseIf txtquiz.Text = "" Then MsgBox "Isi Nilai Quiz", vbCritical, salah txtquiz.SetFocus ElseIf IsNumeric(txtquiz.Text) = False Then MsgBox "Nilai Quiz Harus Angka", vbCritical, salah txtquiz.SetFocus ElseIf txtquiz > 100 Then MsgBox "Nilai Tidak lebih dari 100", vbCritical, salah txtquiz.SetFocus ElseIf txtuts.Text = "" Then MsgBox "Isi Nilai UTS", vbCritical, salah txtuts.SetFocus ElseIf IsNumeric(txtuts.Text) = False Then MsgBox "Nilai UTS Harus Angka", vbCritical, salah txtuts.SetFocus ElseIf txtuts > 100 Then MsgBox "Nilai Tidak lebih dari 100", vbCritical, salah txtuts.SetFocus ElseIf txtuas.Text = "" Then MsgBox "Isi Nilai UAS", vbCritical, salah txtuas.SetFocus ElseIf IsNumeric(txtuas.Text) = False Then MsgBox "Nilai UAS Harus Angka", vbCritical, salah txtuas.SetFocus ElseIf txtuas > 100 Then MsgBox "Nilai Tidak lebih dari 100", vbCritical, salah txtuas.SetFocus Else txtakhir = (10 / 100 * Val(txttugas)) + (10 / 100 * Val(txtquiz)) + (30 / 100 * Val(txtuts)) + (50 / 100 * Val(txtuas)) List1.AddItem txtnrp List1.AddItem txtnama List1.AddItem cmb1 + cmb2 + cmb3 End If
End Sub
Private Sub cmdsimpan_Click() If Not konek() Then MsgBox "Gak bisa terhubung ke database!", vbCritical Else If Combo1.Text = "Pilih Matakuliah" Then MsgBox "Pilih MataKuliah", vbCritical, salah ElseIf txtnrp.Text = "" Then MsgBox "Isi NRP", vbCritical, salah ElseIf txtnama.Text = "" Then MsgBox "Isi Nama", vbCritical, salah txtnama.SetFocus ElseIf cmb1.Text = "" Then MsgBox "Isi Kelas", vbCritical, salah cmb1.SetFocus ElseIf IsNumeric(cmb1) = False Then MsgBox "Kelas harus angka", vbCritical, salah cmb1.SetFocus ElseIf cmb1 > 3 Then MsgBox " kelas tidak lebih dari 3", vbCritical, salah cmb1.SetFocus ElseIf cmb2.Text = "" Then MsgBox "Isi Jurusan", vbCritical, salah MsgBox "Atau Silahkan Tambah Jurusan Di Menu Tambah Input Data", vbCritical, salah ElseIf cmb3.Text = "" Then MsgBox "Isi Kelas", vbCritical, salah cmb3.SetFocus ElseIf IsNumeric(cmb3) = False Then MsgBox "Kelas harus angka", vbCritical, salah cmb3.SetFocus ElseIf cmb3 > 10 Then MsgBox " kelas jurusan tidak lebih dari 10", vbCritical, salah cmb3.SetFocus ElseIf txttugas.Text = "" Then MsgBox "Isi Nilai tugas", vbCritical, salah txttugas.SetFocus ElseIf IsNumeric(txttugas.Text) = False Then MsgBox "Nilai tugas Harus Angka", vbCritical, salah txttugas.SetFocus ElseIf txtquiz.Text = "" Then MsgBox "Isi Nilai Quiz", vbCritical, salah txtquiz.SetFocus ElseIf IsNumeric(txtquiz.Text) = False Then MsgBox "Nilai Quiz Harus Angka", vbCritical, salah txtquiz.SetFocus ElseIf txtuts.Text = "" Then MsgBox "Isi Nilai UTS", vbCritical, salah txtuts.SetFocus ElseIf IsNumeric(txtuts.Text) = False Then MsgBox "Nilai UTS Harus Angka", vbCritical, salah txtuts.SetFocus ElseIf txtuas.Text = "" Then MsgBox "Isi Nilai UAS", vbCritical, salah txtuas.SetFocus ElseIf IsNumeric(txtuas.Text) = False Then MsgBox "Nilai UAS Harus Angka", vbCritical, salah txtuas.SetFocus ElseIf txtakhir = "" Then MsgBox "Nilai Akhir Harus Ada Nilai", vbCritical, salah cmdproses.SetFocus Else If MsgBox("save to continue?", vbQuestion + vbYesNo) = vbNo Then Cancel = 1 Else con.Execute "insert into mahasiswa values('" & Combo1 & "','" & txtnrp & "','" & txtnama & "','" & cmb1 + " " + cmb2 + " - " + cmb3 & "','" & txttugas & "','" & txtquiz & "','" & txtuts & "','" & txtuas & "','" & txtakhir & "')" MsgBox "Data tersimpan", vbInformation, simpan tampil txtnrp.Text = "" txtnama.Text = "" txttugas.Text = "" txtquiz.Text = "" txtuts.Text = "" txtuas.Text = "" txtakhir.Text = "" cmb1.Text = "" cmb2.Text = "" cmb3.Text = "" List1.Clear
txtnrp.Enabled = False txtnama.Enabled = False txttugas.Enabled = False txtquiz.Enabled = False txtuts.Enabled = False txtuas.Enabled = False cmdclear.Enabled = False cmdproses.Enabled = False cmdclearlist.Enabled = False Combo1.Text = "Pilih MataKuliah" cmdtambah.Enabled = False cmb1.Enabled = False cmb2.Enabled = False cmb3.Enabled = False Combo1.Enabled = True End If End If End If End Sub
Private Sub cmdtambah_Click()
txtnrp.Text = "" txtnama.Text = "" txttugas.Text = "" txtquiz.Text = "" txtuts.Text = "" txtuas.Text = "" cmb1.Text = "" cmb2.Text = "" cmb3.Text = "" txtnrp.Enabled = True txtnama.Enabled = True txttugas.Enabled = True txtquiz.Enabled = True txtuts.Enabled = True txtuas.Enabled = True cmdclear.Enabled = True cmdproses.Enabled = True cmdclearlist.Enabled = True cmb1.Enabled = True cmb2.Enabled = True cmb3.Enabled = True Combo1.Enabled = False
End Sub Sub tampil() rec.Open "Select * from Mahasiswa ", con, adOpenKeyset, adLockOptimistic Set grid.DataSource = Nothing Set grid.DataSource = rec rec.Close End Sub
Private Sub Combo1_click()
If Combo1.Text = "Pilih Mahasiswa" Then cmdtambah.Enabled = False Else cmdtambah.Enabled = True End If
End Sub Private Function konek() As Boolean On Error GoTo out Set conek = New ADODB.Connection conek.Open "provider = microsoft.ace.oledb.12.0; data source = " & App.Path & "\dbmahasiswa.accdb;Persist Security Info=False" conek.CursorLocation = adUseClient konek = True out: End Function
Private Sub Form_Load()
X = App.Path & "\matakuliah.txt" Open X For Input As #1 While Not EOF(1)
Input #1, mata
Combo1.AddItem mata Combo2.AddItem mata Combo3.AddItem mata Combo4.AddItem mata Wend
Close #1
Y = App.Path & "\kelas.txt" Open Y For Input As #4 While Not EOF(4)
Input #4, kelas
cmb2.AddItem kelas cmb5.AddItem kelas
Wend
Close #4 If Not konek() Then MsgBox "Gak bisa terhubung ke database!", vbCritical, salah Else koneksi tampil End If
End Sub
Private Sub tmbdata_Click() If txtdtinp = "" Then MsgBox "Data Tidak Boleh Kosong" Else
X = App.Path & "\matakuliah.txt" Open X For Append As #3
Print #3, txtdtinp Close #3
Combo1.AddItem txtdtinp Combo2.AddItem txtdtinp Combo3.AddItem txtdtinp Combo4.AddItem txtdtinp MsgBox "Matakuliah Telah Di tambahkan", vbInformation, benar txtdtinp.Text = "" End If
End Sub
Private Sub tmbjrs_Click() If txtjrs = "" Then MsgBox "Data Tidak Boleh Kosong" Else
X = App.Path & "\kelas.txt" Open X For Append As #2
Print #2, txtjrs Close #2
cmb5.AddItem txtjrs cmb2.AddItem txtjrs MsgBox "Jurusan Telah Di tambahkan", vbInformation, benar txtjrs.Text = "" End If
End Sub
Private Sub txtcari2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Set rs = New ADODB.Recordset rs.Open "SELECT * FROM Mahasiswa WHERE NRP + MataKuliah ='" + txtcari2.Text + Combo4.Text + "'", con If Not rs.EOF Then ednama.Enabled = True ednrp.Enabled = True edkelas.Enabled = True Command10.Enabled = True ElseIf rs.EOF Then MsgBox "Maaf, NRP Dan MataKuliah Tidak sesuai!", vbCritical, salah End If End If End Sub
Download Update Aplikasi Database mahasiswa Klik link di bawah ini !!! [You must be registered and logged in to see this link.] |
|