Solved

Number Search in combo box of  vsflexgrid.

Posted on 2001-08-01
7
990 Views
Last Modified: 2007-12-19
Hi,

I am creating one accounting application.
In the application i have purchase screen wherein user can purchase number of product in an order.
To show Products in purchase order i have used vsflexgrid.
In vsflexgrid user can add/modify the products.

Now i have one problem,
I am having combo box in first columns of vsflexgrid, combo box shows all the product number available in database.
Let us say i have product numbers like 1,10,11,2,23,50,100, etc.
Combox box in vsflexgrid shows all these product number.

When typing in the grid, autofill works when I type a 1 it brings up
Product 1 and when I type a 5 it brings up item 50 but when I type 10 it doesn't bring up anything.

What i need is if user type 10 then the combo box of the grid should show number 10, etc.

Any help in this regards will be highly appreciated.


Thanks in advance.


Sudarshan


0
Comment
Question by:sudarshan_shir
7 Comments
 
LVL 5

Expert Comment

by:KDivad
ID: 6343980
In the Form's Gen. Dec. section, add:

Private SkipChange As Boolean

In the combobox's change event, compare what the user has typed:

Dim I As Long
Dim X As Long
X = Len(Combo1.Text)
For I = 0 To Combo1.ListCount - 1
    If Left$(Combo1.List(I), X) = Combo1.Text Then
        Combo1.Text = Combo1.List(I)
        Combo1.SeLStart = X
        Combo1.SelLength = Len(Combo1.Text)
        Exit For
    End If
Next

And in the KeyDown event:

If KeyCode = vbKeyBack Then SkipChange = True


This is the same basic idea I use for an auto-complete combobox.
0
 
LVL 5

Accepted Solution

by:
KDivad earned 100 total points
ID: 6343986
Forgot a part:

.......
X = Len(Combo1.Text)
If SkipChange Then Exit Sub
For I = 0 To Combo1.ListCount - 1
.......
0
 
LVL 5

Expert Comment

by:KDivad
ID: 6343987
One more time:

.......
X = Len(Combo1.Text)
If SkipChange Then
    SkipCahnge = False
    Exit Sub
End If
For I = 0 To Combo1.ListCount - 1
.......
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 5

Expert Comment

by:KDivad
ID: 6343990
You've got to be getting tired of this. <sigh>

SkipCahnge = False

should be:

SkipChange = True
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6344401
Do you have the ComboSearch property set to flexCmbSearchAll ? I think that if you choose one of the other settings it affects the way the searching works.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7198390
Hi sudarshan_shir,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept KDivad's comment(s) as an answer.

sudarshan_shir, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7213213
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel Vlookup to move data back to source. 4 90
MsgBox 2 54
Create Files based on Cell Values in a Range in Excel 12 39
Send outlook email from VBS Script 2 29
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question