Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2001-06-06
10
Medium Priority
?
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 160 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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 …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

705 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