Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching from a combo box to a MSHFlexGrid
Message
 
To
All
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Title:
Searching from a combo box to a MSHFlexGrid
Miscellaneous
Thread ID:
00621748
Message ID:
00621748
Views:
55
I have a MSHFlexGrid that is bound to an Access Database using the DataEnvironment in VB Enterprise Edition 6.0.
On the same form, I also have a combo box and a command button next to it called Search. This button and combo box provides a way for the user to locate a particular Product within the MSHFlexGrid's list. The combo box is for the user to enter a string and the Search button initiates the search. The caption on the button should change to "Find Next" for each subsequent search for the same string.
"Search" indicates that the search will commence from the top of the list while "Find Next" indicates that the search should continue from the previously located Product in the list. Changing the search string should reset the button caption to "Search.
Thus, it should be possible for the user to search through the Product list looking for a particular string by clicking "Search and then clicking "Find Next" until the desired Product is highlighted. The search should be case sensitive and all cells of each row should be examined.
Each time a search is performed, the search string should be added automatically to the combo box for future selection by the user. The combo box should not contain duplicates.

So far, here is the code that I have:

Option Explicit
Private strComboText As String

Private Sub cmdSearch_Click()
If cmdSearch.Caption = "&Search" Then
strComboText = Combo1.Text
If strComboText = "" Then
Exit Sub
End If
deOrderEntrySystem.rsProducts.Find "Title Like '" & strComboText & "*'", 0, adSearchForward, adBookmarkFirst
cmdSearch.Caption = "&Find Next"
Else
deOrderEntrySystem.rsProducts.Find "Title Like '" & strComboText & "*'", 1, adSearchForward, adBookmarkCurrent
End If
If deOrderEntrySystem.rsProducts.EOF Then
MsgBox "Match not found", vbInformation, "DB Access"
deOrderEntrySystem.rsProducts.MoveFirst
cmdSearch.Caption = "&Search"
End If
End Sub

Unfortunately, this will only search in the Title column,I’ve tried them all but can’t get it to search them all together, only individually. By the way, the ISBN column is also the primary key in the database. I tried that one as well but it will only search that column. Also, how can I get it to highlight the recordset that has been found, and add the search string to the combo box automatically?

Again, many thanks for taking time out for this even though you don't even know me.
Reply
Map
View

Click here to load this message in the networking platform