Results 1 to 7 of 7

Thread: Martys thread...

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Martys thread...

    I can't get into it...it gives me a blank page???

  2. #2

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Martys thread...


  3. #3

  4. #4
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Re: Martys thread...

    Looks so promising, from what little I can see...

    Private Sub Form_Load()

    ' Create the instance of the database class
    Set gDB = New CDatabase

    ' Open the database
    gDB.dbName = App.Path & "\northwind.MDB"

    ' Create an...

  5. #5
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Re: Martys thread...

    AhA!

    There we go:




    Problem with NewVBCode Tags

    VB Code:
    1. Private Sub Form_Load()
    2.  
    3. ' Create the instance of the database class
    4. Set gDB = New CDatabase
    5.  
    6. ' Open the database
    7. gDB.dbName = App.Path & "\northwind.MDB"
    8.  
    9. ' Create an object variable for the ColumnHeader object.
    10. Dim clmX As ColumnHeader
    11. ' Add ColumnHeaders.
    12. Set clmX = lvFind.ColumnHeaders.Add(, , "Product", (lvFind.Width - 1066) / 2)
    13. Set clmX = lvFind.ColumnHeaders.Add(, , "Supplier ID", (lvFind.Width - 1066) / 2)
    14. Set clmX = lvFind.ColumnHeaders.Add(, , "Category ID", 976)
    15.  
    16. lvFind.BorderStyle = ccFixedSingle ' Set BorderStyle property.
    17. lvFind.View = lvwReport ' Set View property to Report.
    18.  
    19. ' Label OptionButton controls with SortOrder options.
    20. OptSort(0).Caption = "Sort Ascending"
    21. OptSort(1).Caption = "Sort Descending"
    22. lvFind.SortOrder = lvwAscending ' Sort ascending.
    23. OptSort(0).Value = True
    24.  
    25. End Sub
    26.  
    27. Private Sub lvFind_ColumnClick(ByVal ColumnHeader As ColumnHeader)
    28. ' When a ColumnHeader object is clicked, the ListView control is
    29. ' sorted by the subitems of that column.
    30. ' Set the SortKey to the Index of the ColumnHeader - 1
    31. lvFind.SortKey = ColumnHeader.Index - 1
    32. ' Set Sorted to True to sort the list.
    33. lvFind.Sorted = True
    34. End Sub
    35. Private Sub Form_Activate()
    36.  
    37. txtWord.SetFocus
    38.  
    39. End Sub
    40. Private Sub Form_Unload(Cancel As Integer)
    41.  
    42. Set frmFind = Nothing
    43.  
    44. End Sub
    45. Private Sub lvFind_DblClick()
    46.  
    47. cmdFind(findCloseButton) = True
    48.  
    49. End Sub
    50. Private Sub cmdFind_Click(Index As Integer)
    51.  
    52. Dim sSQLProducts As String
    53. Dim sErr As String
    54. Dim itmX As ListItem ' Create a variable to add ListItem objects.
    55.  
    56. Select Case Index
    57. Case findFindItButton
    58. On Error Resume Next
    59. lvFind.ListItems.Clear
    60. sSQLProducts = "Select * from Products where ProductName like '*" & txtWord & "*' "
    61. Set mrsProducts = gDB.DB.OpenRecordset(sSQLProducts, dbOpenDynaset)
    62. If Err.Number <> 0 Then
    63. sErr = Err.Description
    64. On Error GoTo 0
    65. Err.Raise dbOpenRSError, "cmdFind_Click", sErr
    66. End If
    67.  
    68. While Not mrsProducts.EOF
    69. Set itmX = lvFind.ListItems.Add(, , CStr(mrsProducts!ProductName))
    70. itmX.SubItems(1) = CStr(mrsProducts!SupplierID)
    71. itmX.SubItems(2) = mrsProducts!CategoryID
    72. mrsProducts.MoveNext
    73. Wend
    74. mrsProducts.Close
    75.  
    76. Case findCloseButton
    77. Unload Me
    78. Case Else
    79. ColorListviewRow lvFind, 5, vbRed ' use 16711681 instead of vbBlue
    80. End Select
    81.  
    82. End Sub

  6. #6

  7. #7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width