Listview search button

access , vb6.o , java Kenya
  • 10 years ago

    Help me please. Am doing an HRM system using vb6 and access database. Every thing is functioning well except search button,which is supposed to display all records with similar creteria. ie if users selects "GENDER" from cboGender and "Male" from cboValue, then after clicking "SEARCH" button it should display all male Employees in the database. Here are relevant codes.

    Option Explicit

    Private mobjConn As ADODB.Connection Private mobjCmd As ADODB.Command Private mobjRst As ADODB.Recordset Private mstrMaintMode As String Private mblnFormActivated As Boolean Private mblnUpdateInProgress As Boolean

    'Employees LV SubItems Indexes Private Const mlngFST As Long = 1 Private Const mlngLST As Long = 2 Private Const mlngGDR As Long = 3 Private Const mlngDOB As Long = 4 Private Const mlngID As Long = 5 Private Const mlngADR As Long = 6 Private Const mlngPST As Long = 7 Private Const mlngPHN As Long = 8 Private Const mlngEMPN As Long = 9 Private Const mlngDES As Long = 10 Private Const mlngJPG As Long = 11 Private Const mlngCOW As Long = 12 Private Const mlngCRTS As Long = 13 Private Const mlngPRS As Long = 14 Private Const mlngRPD As Long = 15 Private Const mlngRECN As Long = 16

    '************************ ' General Form Events * '************************* '-----------------------------------------------------------------------------

    Private Sub Form_Load() '-----------------------------------------------------------------------------

    ConnectionToDB
    SetupColumns LoadEmployeesListView End Sub

    '-----------------------------------------------------------------------------

    Private Sub PopulateListItem(pobjListItem As ListItem) '-----------------------------------------------------------------------------

    With pobjListItem .SubItems(mlngFST) = txtFirstname.Text .SubItems(mlngLST) = txtLast.Text .SubItems(mlngGDR) = txtGender.Text .SubItems(mlngDOB) = DTPicker1 .SubItems(mlngID) = txtIdpass.Text .SubItems(mlngADR) = txtAddressn.Text .SubItems(mlngPST) = txtPostaln.Text '.SubItems(mlngPHN) = txtPhonen.Text .SubItems(mlngEMPN) = txtEmployment.Text .SubItems(mlngDES) = txtDesignation.Text .SubItems(mlngJPG) = txtJobgp.Text .SubItems(mlngCOW) = txtCow.Text .SubItems(mlngCRTS) = txtCurrent.Text .SubItems(mlngPRS) = txtPrevious.Text .SubItems(mlngRPD) = DTPicker2 .SubItems(mlngPHN) _ = IIf(txtArea.Text = "", _ "", _ "(" & txtArea.Text & ") " & txtPrfx.Text & "-" & txtLine. Text) End With End Sub

    '-----------------------------------------------------------------------------

    Private Sub SetupColumns() With lvwEmployees .ColumnHeaders.Clear .ColumnHeaders.Add , , "TITLE", .Width * 0.1 .ColumnHeaders.Add , , "FIRSTNAME", .Width * 0.11 .ColumnHeaders.Add , , "LASTNAME", .Width * 0.1 .ColumnHeaders.Add , , "GENDER", .Width * 0.08 .ColumnHeaders.Add , , "DOB", .Width * 0.09 .ColumnHeaders.Add , , "IDPASSPORTNO", .Width * 0.15 .ColumnHeaders.Add , , "ADDRESS", .Width * 0.09 .ColumnHeaders.Add , , "POSTALCODE", .Width * 0.12 .ColumnHeaders.Ad

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programs must be written for people to read, and only incidentally for machines to execute.”