Solved

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

Posted on 2001-06-06
10
172 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vba find the last empty column 10 88
VBA error replacing data 6 37
VB6 - Compare and highlight cell not the same 3 43
Child Form in front 4 38
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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now