PC Review


Reply
Thread Tools Rate Thread

Create a textbox that displays a list of possible items as we type

 
 
sam
Guest
Posts: n/a
 
      4th Dec 2009
Hi All,

Is it possible to display a list once user starts typing a word in vba?

For eg, I have a userform connected to access database(I can already pull
info from access, based on what user inputs in ID field), So Once a user
starts typing
in a text box, lets say User Name textbox, a list of users is displayed
(something like google search, we start writing in the search bar and it
suggests us what we might want based on what text we input)

SO if I type in "A" in User Name text box, I get all the names starting with
"A" such as:

Name: [ A.... ]
Aaron
Aber
Acron

If I type in a number, "2" I get the list of phone numbers starting with 2
and so on.

Can this be done in VBA?

Hope I made it clear.

Thanks in Advance


 
Reply With Quote
 
 
 
 
RB Smissaert
Guest
Posts: n/a
 
      4th Dec 2009
Put code in that textbox Change event that pulls data from Access according
to the text in that textbox. Then show that data in another textbox or a
label
or whatever suitable.

So, you SQL will be something like this:

Dim strSQL As String

strSQL = "select field1 from table1 where field1 like " & chr(39) &
textbox1.text & "%" & chr(39)

I don't use Access often (prefer SQLite), so your SQL may be slightly
different.


RBS


"sam" <(E-Mail Removed)> wrote in message
news7607532-A360-48FF-9807-(E-Mail Removed)...
> Hi All,
>
> Is it possible to display a list once user starts typing a word in vba?
>
> For eg, I have a userform connected to access database(I can already pull
> info from access, based on what user inputs in ID field), So Once a user
> starts typing
> in a text box, lets say User Name textbox, a list of users is displayed
> (something like google search, we start writing in the search bar and it
> suggests us what we might want based on what text we input)
>
> SO if I type in "A" in User Name text box, I get all the names starting
> with
> "A" such as:
>
> Name: [ A.... ]
> Aaron
> Aber
> Acron
>
> If I type in a number, "2" I get the list of phone numbers starting with 2
> and so on.
>
> Can this be done in VBA?
>
> Hope I made it clear.
>
> Thanks in Advance
>
>


 
Reply With Quote
 
Tom Hutchins
Guest
Posts: n/a
 
      4th Dec 2009
Instead of a textbox, why don't you use a listbox or combobox? Execute a
query against the database to get the entire set of valid entries for the
control. Cycle through the query's output & add the records to the combobox
(.AddItem). Set the MatchEntry property of the combobox to
FmMatchEntryComplete to get the kind of progressive autocomplete behavior you
described.

Hope this helps,

Hutch

"sam" wrote:

> Hi All,
>
> Is it possible to display a list once user starts typing a word in vba?
>
> For eg, I have a userform connected to access database(I can already pull
> info from access, based on what user inputs in ID field), So Once a user
> starts typing
> in a text box, lets say User Name textbox, a list of users is displayed
> (something like google search, we start writing in the search bar and it
> suggests us what we might want based on what text we input)
>
> SO if I type in "A" in User Name text box, I get all the names starting with
> "A" such as:
>
> Name: [ A.... ]
> Aaron
> Aber
> Acron
>
> If I type in a number, "2" I get the list of phone numbers starting with 2
> and so on.
>
> Can this be done in VBA?
>
> Hope I made it clear.
>
> Thanks in Advance
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create type-over textbox. Andrew Microsoft Word Document Management 2 30th Oct 2009 07:16 PM
Type HTML into a textbox and automatically create .HTM files? =?Utf-8?B?TWlrZQ==?= Microsoft ASP .NET 3 9th Apr 2007 11:00 AM
Microsoft Access: How do I create a drop down list that stores the index value, but displays text value? FlyingMonkey Microsoft Access Form Coding 3 23rd Mar 2007 01:51 PM
How do I create a Drop Down List with Hyperlinks as List Items in ASP.NET Tony Tone Microsoft ASP .NET 0 28th Apr 2006 07:38 PM
Create Drop Down List that displays only field names from a table JS Microsoft Access 5 25th Jul 2005 12:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:32 PM.