Recordset of ComboBox Type Dim rs As New - TopicsExpress



          

Recordset of ComboBox Type Dim rs As New ADODB.Recordset Search Serial Number Dim sn As New ADODB.Recordset Recordset tblissuance Dim issue As New ADODB.Recordset Description Identification Dim pk As Boolean Private Sub btncancel_Click() Unload Me End Sub Private Sub btnsave_Click() If pk = True Then Field(s) Required If txtIssuedto.Text = Then MsgBox Name of Personnel Required!, vbInformation + vbOKOnly txtIssuedto.SetFocus ElseIf txtDepartment.Text = Then MsgBox Department Required!, vbInformation + vbOKOnly txtDepartment.SetFocus ElseIf txtContact.Text = Then MsgBox Contact No. Required!, vbInformation + vbOKOnly txtContact.SetFocus ElseIf txtIssuedon.Text = Then MsgBox Date Issue(d) Required!, vbInformation + vbOKOnly ElseIf txtMouse.Text = And txtKeyboard.Text = And txtMonitor.Text = _ And txtOther.Text = Then MsgBox Specify other Accessories, vbInformation + vbOKOnly txtOther.SetFocus Else dbs.BeginTrans dbs.Execute INSERT INTO tblissuance ([Serial Number], [Issued To], [Department], _ & [Contact], [Issued On], [Mouse], [Keyboard], [Monitor], _ & [Adapter], [Others]) values ( & txtSerial.Text & , _ & & txtIssuedto.Text & , & txtDepartment.Text & , _ & & txtContact.Text & , & txtIssuedon.Text & , _ & & txtMouse.Text & , & txtKeyboard.Text & , _ & & txtMonitor.Text & , & txtAdapter.Text & , _ & & txtOther.Text & ) dbs.CommitTrans If MsgBox(New Personnel Added. Create Report?, vbYesNo + vbInformation) = vbOK Then issuance issuancedata Else Unload Me End If End If Else dbs.BeginTrans dbs.Execute INSERT INTO tbldescription ([Serial Number], _ & [Issued To], [Description], [Date Report]) values _ & ( & txtSerial.Text & , & txtissuedto1.Text & , _ & & txtdescription.Text & , & cmbdatereport.Text & ) dbs.CommitTrans End If End Sub Private Sub chkadapter_Click() Selection of Accessory (Adapter) If chkAdapter.Value = 0 Then txtAdapter.Text = txtAdapter.Locked = True Else txtAdapter.Text = txtAdapter.Locked = False End If End Sub Private Sub chkKeyboard_Click() Selection of Accessory (Keyboard) If chkKeyboard.Value = 0 Then txtKeyboard.Text = txtKeyboard.Locked = True Else txtKeyboard.Text = txtKeyboard.Locked = False End If End Sub Private Sub chkmonitor_Click() Selection of Accessory (Monitor) If chkMonitor = 0 Then txtMonitor.Text = txtMonitor.Locked = True Else txtMonitor.Text = txtMonitor.Locked = False End If End Sub Private Sub chkmouse_Click() Selection of Accessory (Mouse) If chkMouse.Value = 0 Then txtMouse.Text = txtMouse.Locked = True Else txtMouse.Text = txtMouse.Locked = False End If End Sub Private Sub chkOther_Click() Selection of Accessory (Others) If chkOther.Value = 0 Then txtOther.Text = txtOther.Enabled = True Else txtOther.Text = txtOther.Locked = False End If End Sub Private Sub dg1_DblClick() Search End Sub Private Sub dg1_KeyPress(keyascii As Integer) If keyascii = 13 Then Search End If End Sub Private Sub Form_Load() Call typeloop lockedall tbanner End Sub Private Sub Form_Unload(Cancel As Integer) frmMain.Show End Sub ComboBox(Type) Loop from Database Private Sub typeloop() Dim cmb As Integer Set rs = Nothing rs.Open select [Type] from tbltype, dbs, , adLockReadOnly rs.MoveFirst cmb = rs.RecordCount For cmb = rs.AbsolutePage To rs.RecordCount cmbType.AddItem rs![Type] rs.MoveNext Next End Sub Private Sub txtSerial_Change() Searching Serial Number Set sn = Nothing snn = Select [Serial Number], [Type], [Brand], [Model],[Specification] _ & from tblitem where [Serial Number] _ & like % & txtSerial.Text & % sn.Open snn, dbs, , adLockReadOnly Set dg1.DataSource = Nothing If sn.RecordCount > 0 Then Set dg1.DataSource = sn dg1.Visible = True Else dg1.Visible = False End If End Sub Private Sub txtSerial_KeyPress(keyascii As Integer) If keyascii = 13 Then Search End If End Sub Private Sub Search() Dim intresponse As Integer Condition in Searching of Record(s) If sn.RecordCount > 0 Then Set dg1.DataSource = sn dg1.Visible = True databind issuance issuancedata txtmessage.Text = Record Found!! dg1.Visible = False intresponse = MsgBox _ (New Personnel?(Yes) Report Item?(No) _ & Back to Main Form(Cancel)?, _ vbYesNoCancel + vbInformation + _ vbDefaultButton1, Adding) Messagebox Response If intresponse = vbYes Then pk = True bbanner unlockedall clearissue framedescription.Visible = False frameissuance.Visible = True txtIssuedon.Value = Now If KeyCode = vbKeyF12 Then btnsave_Click End If ElseIf intresponse = vbNo Then pk = False framedescription.Visible = True frameissuance.Visible = False issuance issuancedata txtissuedto1.Text = txtIssuedto.Text txtissuedto1.Locked = True bbanner Else tbanner Unload Me End If Else txtmessage.Text = No Record Found!! dg1.Visible = False If MsgBox(No Record Found! Insert New Item., vbOKCancel + _ vbInformation, Adding...) = vbCancel Then Unload Me Else End If End If End Sub Private Sub databind() txtSerial.Text = sn![Serial Number] cmbType.Text = sn![Type] txtBrand.Text = sn![Brand] txtModel.Text = sn![Model] txtSpecification.Text = sn![Specification] End Sub Private Sub clearitemall() cmbType.Text = txtBrand.Text = txtModel.Text = txtSpecification.Text = txtIssuedto.Text = txtDepartment.Text = txtContact.Text = End Sub Private Sub lockedall() cmbType.Locked = True cmbType.Enabled = False txtBrand.Locked = True txtModel.Locked = True txtSpecification.Locked = True txtIssuedto.Locked = True txtDepartment.Locked = True txtContact.Locked = True chkMouse.Locked = True chkKeyboard.Locked = True chkMonitor.Locked = True chkAdapter.Locked = True chkOther.Locked = True End Sub Private Sub unlockedall() txtIssuedto.Locked = False txtDepartment.Locked = False txtContact.Locked = False chkMouse.Locked = False chkKeyboard.Locked = False chkMonitor.Locked = False chkAdapter.Locked = False chkOther.Locked = False End Sub Private Sub tbanner() framebutton.Visible = False framebutton.Enabled = False txtmessage.Visible = True txtmessage.Enabled = True End Sub Private Sub bbanner() framebutton.Visible = True framebutton.Enabled = True txtmessage.Visible = False txtmessage.Enabled = False End Sub Private Sub issuance() Set issue = Nothing sqlissue = Select `tblitem`.`Serial Number`, `tblissuance`.`Serial Number`, _ & `tblissuance`.`Issued To`, `tblissuance`.`Department`, _ & `tblissuance`.`Contact`, `tblissuance`.`Issued On`, _ & `tblissuance`.`Mouse` ,`tblissuance`.`Keyboard`, _ & `tblissuance`.`Monitor`, `tblissuance`.`Adapter`, _ & `tblissuance`.`Others` from tblitem, tblissuance _ & where`tblitem`.`Serial Number` = & txtSerial.Text & _ & and `tblitem`.`Serial Number` = `tblissuance`.`Serial Number` issue.Open sqlissue, dbs, , adLockReadOnly issue.MoveFirst End Sub Private Sub issuancedata() txtIssuedto.Text = issue![Issued To] txtDepartment.Text = issue![Department] txtContact.Text = issue![Contact] txtIssuedon.Text = issue![Issued On] txtMouse.Text = issue![Mouse] txtKeyboard.Text = issue![Keyboard] txtMonitor.Text = issue![Monitor] txtAdapter.Text = issue![Adapter] txtOther.Text = issue![Others] End Sub Private Sub clearissue() txtIssuedto.Text = txtDepartment.Text = txtContact.Text = txtMouse.Text = txtKeyboard.Text = txtMonitor.Text = txtAdapter.Text = txtOther.Text = End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If pk = True Then If KeyCode = vbKeyF12 Then btnsave_Click ElseIf KeyCode = vbKeyEscape Then btncancel_Click End If Else End If End Sub Private Sub creport() dbs.BeginTrans dbs.Execute INSERT INTO tbldescription ([Serial Number], _ & [Issued To], [Description], [Date Report]) values _ & ( & txtSerial.Text & , & txtissuedto1.Text & , _ & & txtdescription.Text & , & cmbdatereport.Text & ) dbs.CommitTrans End Sub
Posted on: Thu, 06 Mar 2014 12:24:26 +0000

Trending Topics



Recently Viewed Topics




© 2015