473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with Incremental Search box

I have a incremental search box that has been working fine for a couple of
months but is now acting up. This search box is from the cd that comes with
Getz's book, so I did not write it and have only a superficial understanding
of how it works.

I have had some trouble in the past when my code goes to another form and
comes back sometimes the search function did not work properly. Then I
added a line to requery it and it worked fine. But now I have a different
problem.

I have over 1700 records that populate this based on a query. I have
checked the underlying table and it looks fine and I have rund the query
associated with the listbox and that looks fine as well. But it only
searches to the 1st letter of whatever I initially type in. If I type in
the letter "B", I will get the first entry that begins with "B", but nothing
after that (I cannot even scroll to it). If I type in the letter "Z", I get
there, but no further and now all the records between #1 and "Z" (maybe 1600
of them) are available to me.

This is simply wierd IMHO. Does anyone have an idea where I might look to
find an answer as to why it is behaving so strangely? It was working fine a
little while ago. I've made chgs to the system recently, but none that I
can think of should have affected this.
Thanks.
Nov 13 '05 #1
3 3412
"Colleyville Alan" wrote
I have a incremental search box that has
been working fine for a couple of
months but is now acting up. This search
box is from the cd that comes with
Getz's book,


Could you be a little more specific, Alan? Edition of the book, chapter,
name of the search box, the topic in the chapter, etc.? And, any mods you
may have made, how you are using it, etc.?

Larry Linson
Microsoft Access MVP
Nov 13 '05 #2
"Larry Linson" <bo*****@localhost.not> wrote in message
news:9r*******************@nwrddc01.gnilink.net...
"Colleyville Alan" wrote
> I have a incremental search box that has
> been working fine for a couple of
> months but is now acting up. This search
> box is from the cd that comes with
> Getz's book,


Could you be a little more specific, Alan? Edition of the book, chapter,
name of the search box, the topic in the chapter, etc.? And, any mods you
may have made, how you are using it, etc.?

Larry Linson
Microsoft Access MVP


Ok, here goes: Getz, Litwin, and Gilbert: Access 2000 Developer's Handbook,
Volume 1: Desktop Edition - Chapter 7, pages 413-422 (though I copied the
class module from the cd and only briefly read the pages, I've looked at the
code in the module but do not understand it that well).

I call the following from the Form_Load event:

Sub InitSearch()
'BoundField allows you to have a field to which the list box is bound,
'but isn't the display field.
'The BoundField property must match the field indexed in the Index property.
Dim strMySql As String
Set mis = New IncrementalSearch
mis.DisplayField = "Plan_Name"
mis.BoundField = "Plan_ID"
mis.Index = "Plan_ID"
lstIncSrch.BoundColumn = 2
Set mis.ListBox = lstIncSrch
Set mis.TextBox = txtIncSrch
strMySql = "SELECT DISTINCT [Fund_Holdings_By_Plan].[Plan_Name],
[Fund_Holdings_By_Plan].[Plan_ID] FROM Fund_Holdings_By_Plan " & vbCrLf
strMySql = strMySql & "WHERE (((Fund_Holdings_By_Plan.Plan_ID) Not Like
'TMP*' AND (Fund_Holdings_By_Plan.Plan_ID) Not Like 'CLT*' AND
(Fund_Holdings_By_Plan.Plan_ID) Not Like 'RFP*')) " & vbCrLf
strMySql = strMySql & "ORDER BY [Fund_Holdings_By_Plan].[Plan_Name];"
lstIncSrch.RowSource = strMySql
txtIncSrch.Requery
lstIncSrch.Requery
End Sub
In the 2600+ lines of code, here are all of the references to these two
items:

lstIncSrch.BoundColumn = 2
lstIncSrch.Requery
lstIncSrch.RowSource = strMySql
Set mis.ListBox = lstIncSrch
strPlanId = txtIncSrch.Value
strPlanName = Me.lstIncSrch.Column(0)
strPlanName = Me.lstIncSrch.Column(0) & ".PPT"
txtIncSrch.Requery
txtIncSrch.SetFocus
txtIncSrch.Value = ""

I did not make any changes to the class module, I just copied it from the
sample database per the book's instructions. As to how I am using it, I am
setting the row source to the results of a query (the strMySql stuff above)
to list a group of unique client records. The table looks up by plan name
and returns a plan_ID. I just started having trouble with it recently, but
the latest chgs to the project have been deleting unused tables, queries,
and code. I cannot think of what I did that could change the behavior of
the search box.

Awhile ago, I found that when searching on another form using mutual fund
info, the search box would not get past a certain point but that was because
the fund names were not always in order. When I edited the table to get the
names consistent, it worked fine. In fact, it *still* works fine - I use
the incremental search stuff on 4 different forms and it works fine on 3 of
them. But as far as I can see, I am not doing anything differently there.
In the code above I have the RowSource specified after initializing the
searchbox, but I just did that a few minutes ago - it used to come before it
and I was simply trying something different.
Nov 13 '05 #3
I added a temporary button to my form that simply calls lstIncSrch.requery.
If the box is stuck at a particular location, hitting the requery moves it
one extra line down. But if I type some txt in the txtbox portion, even
though no search takes place, hitting the requery button at that point finds
the text. If I put "Zi" in the box (the last entry in the table) and
requery, the listbox finds that record.

I have older versions of this db as I have been updating and burning to a cd
on a daily basis. Right now I am looking at a version of 3 wks ago that
worked fine, but so far the differences have not been any that I would
expect to affect anything.

"Colleyville Alan" <ae***********@nospam.comcast.net> wrote in message
news:paNCc.106638$eu.11918@attbi_s02...
"Larry Linson" <bo*****@localhost.not> wrote in message
news:9r*******************@nwrddc01.gnilink.net...
"Colleyville Alan" wrote
> I have a incremental search box that has
> been working fine for a couple of
> months but is now acting up. This search
> box is from the cd that comes with
> Getz's book,
Could you be a little more specific, Alan? Edition of the book, chapter,
name of the search box, the topic in the chapter, etc.? And, any mods you may have made, how you are using it, etc.?

Larry Linson
Microsoft Access MVP


Ok, here goes: Getz, Litwin, and Gilbert: Access 2000 Developer's

Handbook, Volume 1: Desktop Edition - Chapter 7, pages 413-422 (though I copied the
class module from the cd and only briefly read the pages, I've looked at the code in the module but do not understand it that well).

I call the following from the Form_Load event:

Sub InitSearch()
'BoundField allows you to have a field to which the list box is bound,
'but isn't the display field.
'The BoundField property must match the field indexed in the Index property. Dim strMySql As String
Set mis = New IncrementalSearch
mis.DisplayField = "Plan_Name"
mis.BoundField = "Plan_ID"
mis.Index = "Plan_ID"
lstIncSrch.BoundColumn = 2
Set mis.ListBox = lstIncSrch
Set mis.TextBox = txtIncSrch
strMySql = "SELECT DISTINCT [Fund_Holdings_By_Plan].[Plan_Name],
[Fund_Holdings_By_Plan].[Plan_ID] FROM Fund_Holdings_By_Plan " & vbCrLf
strMySql = strMySql & "WHERE (((Fund_Holdings_By_Plan.Plan_ID) Not Like 'TMP*' AND (Fund_Holdings_By_Plan.Plan_ID) Not Like 'CLT*' AND
(Fund_Holdings_By_Plan.Plan_ID) Not Like 'RFP*')) " & vbCrLf
strMySql = strMySql & "ORDER BY [Fund_Holdings_By_Plan].[Plan_Name];"
lstIncSrch.RowSource = strMySql
txtIncSrch.Requery
lstIncSrch.Requery
End Sub
In the 2600+ lines of code, here are all of the references to these two
items:

lstIncSrch.BoundColumn = 2
lstIncSrch.Requery
lstIncSrch.RowSource = strMySql
Set mis.ListBox = lstIncSrch
strPlanId = txtIncSrch.Value
strPlanName = Me.lstIncSrch.Column(0)
strPlanName = Me.lstIncSrch.Column(0) & ".PPT"
txtIncSrch.Requery
txtIncSrch.SetFocus
txtIncSrch.Value = ""

I did not make any changes to the class module, I just copied it from the
sample database per the book's instructions. As to how I am using it, I am setting the row source to the results of a query (the strMySql stuff above) to list a group of unique client records. The table looks up by plan name
and returns a plan_ID. I just started having trouble with it recently, but the latest chgs to the project have been deleting unused tables, queries,
and code. I cannot think of what I did that could change the behavior of
the search box.

Awhile ago, I found that when searching on another form using mutual fund
info, the search box would not get past a certain point but that was because the fund names were not always in order. When I edited the table to get the names consistent, it worked fine. In fact, it *still* works fine - I use
the incremental search stuff on 4 different forms and it works fine on 3 of them. But as far as I can see, I am not doing anything differently there.
In the code above I have the RowSource specified after initializing the
searchbox, but I just did that a few minutes ago - it used to come before it and I was simply trying something different.

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Colleyville Alan | last post by:
I have an app that looks up an id number and when a button is clicked, inputs the id # into a query. After running the query, I click a second button which grabs the client name rather than the id...
2
by: mp | last post by:
Hi, Is posible to make incremental search of some databse (table) with c#. I am looking for some example. I know how to do that with Delphi, but I am new in C# .NET and I need your help. ...
1
by: mp | last post by:
Hi, I need help in following... I have used: Visual Studio 2002 or 2003 - C# Access DataBase ADO connection I am looking for example or directions of incremental search.
4
by: rh | last post by:
Hi, I'd like to add an incremental search to my windows form DataGrid that works like the one used in Windows Explorer. In Windows Explorer, when you type a character it jumps to the first item...
4
by: EdB | last post by:
Can anyone provide a sample of how to do an incremental key search on a combo box control?
5
by: Joel Matthew | last post by:
My boss was asking about incremental backups. I was scratching my head, thinking that the transaction log and a backup policy (script) for each record set (sorry about the archaic terminology)...
0
by: prerak_v_shah | last post by:
Hi All, These days I was working on IBM DB2 database for windows with my .Net Application. Now, it was required to backup database created on one machine to the other machine. I was also able...
5
by: DFS | last post by:
This works pretty well, and it's easy, but it's not the ultimate solution. The kludgey part is it uses a hidden field to incrementally capture the keystrokes in the visible field (because executing...
0
by: Bob Greschke | last post by:
I want to create a search function on a Text() widget full of text like the incremental search in emacs -- if you type an "f" emacs goes to the first "f", type another "f" and it goes to the first...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.