Dialog Screen Input Leasing

3. Dialog Screen Input Leasing

Nama Dialog Screen : Form Input Leasing Fungsi : Untuk menginput data Leasing pada database Bentuk : Private Sub Command1_Click On Error Resume Next If Text2 = Or Text1 = Or Text3 = Then MsgBox Lengkapi data, vbCritical, Admin ElseIf Command1.Caption = Simpan Then con.Execute exec Sp_Simpan_Leasing Text5.Text , Text1.Text , Text2.Text , Text3.Text MsgBox Data telah tersimpan, vbInformation, Admin tampil hapus awal ElseIf Command1.Caption = Perbaharui Then con.Execute exec Sp_Update_Leasing Perusahaan= Text5.Text , Nama= Text1.Text ,Alamat= Text2.Text ,tlp= Text3.Text , Id= Text4.Text MsgBox Data Telah TerUpdate, vbInformation, Admin tampil hapus Command1.Caption = Simpan awal Label4.Visible = False Text4.Visible = False End If End Sub Private Sub Command2_Click On Error Resume Next Bukakunci Me If Command2.Value = True Then Command1.Enabled = True Command6.Enabled = False Command3.Enabled = False Command2.Enabled = False Command1.SetFocus End If End Sub Private Sub Command3_Click On Error Resume Next If MsgBoxAnda yakin menghapus data ini..., vbYesNo, Admin = vbYes Then con.Execute exec Sp_Hapus_Leasing Text4 tampil hapus awal End If End Sub Private Sub Command4_Click On Error Resume Next Command1.Caption = Simpan awal hapus Kunci Me Text4.Visible = False Label4.Visible = False DataGrid1.Enabled = True End Sub Private Sub Command5_Click On Error Resume Next If MsgBoxAnda Yakin keluar dari aplikasi ini...., vbYesNo, admin = vbYes Then sink Me Unload Me MDIForm1.Show Else Frm_Leasing.Show End If End Sub Private Sub Command6_Click On Error Resume Next Text4.Visible = False Label4.Visible = False hapus If Command6.Value = True Then Command6.Enabled = False Command1.Enabled = True Command2.Enabled = False Command3.Enabled = False Command4.Enabled = True Command5.Enabled = False End If Bukakunci Me Text5.SetFocus DataGrid1.Enabled = False End Sub Private Sub DataGrid1_Click On Error Resume Next Command1.Caption = Perbaharui aktif Dim RsPindah2 As New ADODB.Recordset If RsPindah2.State = 1 Then RsPindah2.Close RsPindah2.Open select from Leasing where Id_Leasing = DataGrid1.Columns0 , con, 3, 2 If RsPindah2.RecordCount 0 Then With RsPindah2 Text5 = Nama_Perusahaan Text1 = Nama_Leasing Text2 = Alamat Text3 = No_Tlp Text4 = Id_Leasing End With Kunci Me End If Command1.Enabled = False End Sub Private Sub DataGrid1_DblClick On Error Resume Next If Text6 = Then Text5.SetFocus Exit Sub End If Frm_Jual.Show Frm_Jual.Text7 = DataGrid1.Columns0 Frm_Jual.Text16 = DataGrid1.Columns1 Frm_Jual.Text21 = DataGrid1.Columns2 Frm_Jual.Combo2.SetFocus Frm_Jual.Text16.Locked = True Frm_Jual.Text21.Locked = True Text6 = Unload Me End Sub Private Sub DataGrid1_KeyPressKeyAscii As Integer On Error Resume Next If KeyAscii = 13 Then If Text6 = Then Text5.SetFocus Exit Sub End If Frm_Jual.Show Frm_Jual.Text7 = DataGrid1.Columns0 Frm_Jual.Text16 = DataGrid1.Columns1 Frm_Jual.Text21 = DataGrid1.Columns2 Frm_Jual.Combo2.SetFocus Frm_Jual.Text16.Locked = True Frm_Jual.Text21.Locked = True Text6 = Frm_Leasing.Visible = False End If End Sub Private Sub Form_Load On Error Resume Next BukaDB Kunci Me awal tampil Frm_Leasing.Left = 2685 Frm_Leasing.Top = 900 Frm_Leasing.Width = 9045 Frm_Leasing.Height = 8625 Text4.Visible = False Label4.Visible = False Text6 = End Sub Sub tampil On Error Resume Next If rec.State = 1 Then rec.Close rec.Open select Id_Leasing,Nama_Perusahaan,Nama_Leasing,Alamat,No_Tlp from Leasing, con, 3, 3 Set DataGrid1.DataSource = rec.DataSource End Sub Sub awal On Error Resume Next Command1.Enabled = False Command2.Enabled = False Command3.Enabled = False Command4.Enabled = False Command5.Enabled = True Command5.SetFocus Command6.Enabled = True End Sub Sub aktif On Error Resume Next Command1.Enabled = True Command2.Enabled = True Command3.Enabled = True Command4.Enabled = True Command5.Enabled = False Command6.Enabled = False End Sub Sub hapus On Error Resume Next Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = End Sub Private Sub Text1_KeyPressKeyAscii As Integer On Error Resume Next If KeyAscii = 13 Then Text2.SetFocus End If End Sub Private Sub Text2_KeyPressKeyAscii As Integer On Error Resume Next If KeyAscii = 13 Then Text3.SetFocus End If End Sub Private Sub Text4_Change On Error Resume Next If Text4.Text = kosong Then MsgBox asfasfasf, vbCritical hapus End If End Sub Private Sub Text5_KeyPressKeyAscii As Integer On Error Resume Next If KeyAscii = 13 Then Text1.SetFocus End If End Sub

4. Dialog Screen Input Kendaraan