Solved

Typing in a texbox and search for char!!!!

Posted on 2001-06-06
10
173 Views
Last Modified: 2010-05-02
Hi,
I need the code when i type some text in a textbox like "So" that the textbox autom. search the rest like "sof" of "soft" i have the textbox linked to a database.

Thanks
0
Comment
Question by:pfjvisser
  • 5
  • 4
10 Comments
 
LVL 18

Expert Comment

by:deighton
ID: 6159683
Do you mean that the textbox will 'auto complete' (such as an address in EE)?
0
 

Author Comment

by:pfjvisser
ID: 6159783
yes plz, do you no how to do it,

The text2.text is linked to a row in a database called CD NAAM.

0
 
LVL 3

Expert Comment

by:Maxim10553
ID: 6160542
do you want to scan the database for every keysroke entered? what if no match is found?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:pfjvisser
ID: 6160603
Yes Maxim10553 i want to scan the ROW in the database scaned and if notfound then let me compleet the word i want to type,
0
 
LVL 3

Expert Comment

by:Maxim10553
ID: 6160619
alright i have coded something like this before but not when the textbox is linked, let me see what i can come up with, gotta to do something right now, will get back to you though
0
 

Author Comment

by:pfjvisser
ID: 6160631
Oke thanks,Maxim10553
0
 
LVL 3

Expert Comment

by:Maxim10553
ID: 6165403
Here is some sample code, you need to edit it a little, create a new vb standard exe and insert a textbox in it, clear the caption so it is empty, edit the code a little, and run, should try and auto-complete your words


Option Explicit
Dim cn As New ADODB.Connection
Dim Key As Long

Private Sub Form_Load()

cn.Open ("Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\Temp\db1.mdb")

End Sub

Private Sub Text1_Change()

'dont go at database is backspace is hit
If Key = 8 Then Exit Sub

Dim grabbedtext As String: Dim sql As String
Dim rs As New ADODB.Recordset

grabbedtext = Trim(Text1.Text)

If grabbedtext = "" Then Exit Sub

sql = "Select term from table1 where term like '" & grabbedtext & "%'"

MsgBox sql

Set rs = cn.Execute(sql)

If rs.EOF = False Then
    Text1.Text = rs("Term")
    Text1.SelStart = Len(grabbedtext)
    Text1.SelLength = Len(Text1.Text)
Else
End If

rs.Close
Set rs = Nothing

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
Key = KeyAscii
End Sub
0
 
LVL 3

Expert Comment

by:Maxim10553
ID: 6181296
you still around?
0
 
LVL 3

Accepted Solution

by:
Maxim10553 earned 40 total points
ID: 6183039
did my code help?
0
 

Author Comment

by:pfjvisser
ID: 6283514
Yes, Sory that the answer came late. Thanks ANW.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

810 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