469,336 Members | 6,132 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Simulating Combo Box AutoScroll on a subform list?

I'm looking for some code that makes a list presented in a subform
autoscroll in response to the user typing - like a combo box dropdown
or a regular ListBox does.

I.e. The user is looking at subform that is a list of, say, 2,000
people's names. The first name is "Aardvark, John", and the last name
is "Zero, James".

Instead of scrolling, the user types "S" and is jumped to "Sammons".
Then, on the next keystroke as they type "m", it jumps to "Small", and
after they've typed "i" they're located at the first "Smith". From
the user's perspective, they just typed "smi" without doing anything
else and were magically transported to "Smith".

I've implemented this before, but my code was sort of crude. The
first keystroke popped a dialog, which trapped subsequent keystrokes
and didn't do the locate until the user clicked it's "Locate" button.

Does anybody know of something the more closely duplicates the
existing behavior of MS Access combo box dropdowns/list boxes?

One probem would seem to be able to capture/identify/delimit that
string of keystrokes and somehow know when to stop capturing and start
locating - as opposed to going to "S", then going to "M", then going
to "I" like most combo boxes on web apps seem to.
Nov 12 '05 #1
8 2219
Hi Pete,
I have been struggling with this myself, I went to
http://www.janusys.com/janus/library/ , and got an activeX to do it. They
have some nice components. It was long time ago, so I donīt remember the
details.
Have fun !
Regards
Allan
"PeteCresswell" <Go**********@FatBelly.com> wrote in message
news:74**************************@posting.google.c om...
I'm looking for some code that makes a list presented in a subform
autoscroll in response to the user typing - like a combo box dropdown
or a regular ListBox does.

I.e. The user is looking at subform that is a list of, say, 2,000
people's names. The first name is "Aardvark, John", and the last name
is "Zero, James".

Instead of scrolling, the user types "S" and is jumped to "Sammons".
Then, on the next keystroke as they type "m", it jumps to "Small", and
after they've typed "i" they're located at the first "Smith". From
the user's perspective, they just typed "smi" without doing anything
else and were magically transported to "Smith".

I've implemented this before, but my code was sort of crude. The
first keystroke popped a dialog, which trapped subsequent keystrokes
and didn't do the locate until the user clicked it's "Locate" button.

Does anybody know of something the more closely duplicates the
existing behavior of MS Access combo box dropdowns/list boxes?

One probem would seem to be able to capture/identify/delimit that
string of keystrokes and somehow know when to stop capturing and start
locating - as opposed to going to "S", then going to "M", then going
to "I" like most combo boxes on web apps seem to.

Nov 12 '05 #2
Hi Pete,

I don't have the code but it shouldn't be too hard to do ---

First, you need a textbox where the user types the name he wants to go to.

Second, you need the subform containing a field holding names. The subform needs
to be based on a query with the sort order of the personname field set to
ascending. Comboboxes and Listboxes rely on a sorted list and the subform will
too.

Third you need code in the OnChange event of the textbox that goes to the first
record where personname is : Like Forms!MyForm!NameOfTextBox & "*". This gets
you to the record. You might look in ADH (Getz), there's an example there to do
this with a textbox and a listbox. He uses a recordset that is continuously open
rather that opening and closing the recordset each time a letter is entered in
the textbox. Makes this part much faster.You could highlight the record here too
with conditional formatting.

Finally, you need code that scrolls the subform if the current record is not in
the visible records to place the current record in the group of visible records.
Stephen Lebans (Lebans.com) has some code for this.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"PeteCresswell" <Go**********@FatBelly.com> wrote in message
news:74**************************@posting.google.c om...
I'm looking for some code that makes a list presented in a subform
autoscroll in response to the user typing - like a combo box dropdown
or a regular ListBox does.

I.e. The user is looking at subform that is a list of, say, 2,000
people's names. The first name is "Aardvark, John", and the last name
is "Zero, James".

Instead of scrolling, the user types "S" and is jumped to "Sammons".
Then, on the next keystroke as they type "m", it jumps to "Small", and
after they've typed "i" they're located at the first "Smith". From
the user's perspective, they just typed "smi" without doing anything
else and were magically transported to "Smith".

I've implemented this before, but my code was sort of crude. The
first keystroke popped a dialog, which trapped subsequent keystrokes
and didn't do the locate until the user clicked it's "Locate" button.

Does anybody know of something the more closely duplicates the
existing behavior of MS Access combo box dropdowns/list boxes?

One probem would seem to be able to capture/identify/delimit that
string of keystrokes and somehow know when to stop capturing and start
locating - as opposed to going to "S", then going to "M", then going
to "I" like most combo boxes on web apps seem to.

Nov 12 '05 #3
Try the sample available at:
http://msdn.microsoft.com/library/de...nacbk02/html/O
DC_CookbookChapter8.asp

_______________________________

"PeteCresswell" <Go**********@FatBelly.com> wrote in message
news:74**************************@posting.google.c om...

I'm looking for some code that makes a list presented in a subform
autoscroll in response to the user typing - like a combo box dropdown
or a regular ListBox does.

I.e. The user is looking at subform that is a list of, say, 2,000
people's names. The first name is "Aardvark, John", and the last name
is "Zero, James".

Instead of scrolling, the user types "S" and is jumped to "Sammons".
Then, on the next keystroke as they type "m", it jumps to "Small", and
after they've typed "i" they're located at the first "Smith". From
the user's perspective, they just typed "smi" without doing anything
else and were magically transported to "Smith".

I've implemented this before, but my code was sort of crude. The
first keystroke popped a dialog, which trapped subsequent keystrokes
and didn't do the locate until the user clicked it's "Locate" button.

Does anybody know of something the more closely duplicates the
existing behavior of MS Access combo box dropdowns/list boxes?

One probem would seem to be able to capture/identify/delimit that
string of keystrokes and somehow know when to stop capturing and start
locating - as opposed to going to "S", then going to "M", then going
to "I" like most combo boxes on web apps seem to.
Nov 12 '05 #4
Tom,

After pasting the link back together from the word wrap, I get the message the
Page can not be found!

Steve
"Tom Wickerath" <AOS168 @ comcast . net> wrote in message
news:Hp********@news.boeing.com...
Try the sample available at:
http://msdn.microsoft.com/library/de...nacbk02/html/O DC_CookbookChapter8.asp

_______________________________

"PeteCresswell" <Go**********@FatBelly.com> wrote in message
news:74**************************@posting.google.c om...

I'm looking for some code that makes a list presented in a subform
autoscroll in response to the user typing - like a combo box dropdown
or a regular ListBox does.

I.e. The user is looking at subform that is a list of, say, 2,000
people's names. The first name is "Aardvark, John", and the last name
is "Zero, James".

Instead of scrolling, the user types "S" and is jumped to "Sammons".
Then, on the next keystroke as they type "m", it jumps to "Small", and
after they've typed "i" they're located at the first "Smith". From
the user's perspective, they just typed "smi" without doing anything
else and were magically transported to "Smith".

I've implemented this before, but my code was sort of crude. The
first keystroke popped a dialog, which trapped subsequent keystrokes
and didn't do the locate until the user clicked it's "Locate" button.

Does anybody know of something the more closely duplicates the
existing behavior of MS Access combo box dropdowns/list boxes?

One probem would seem to be able to capture/identify/delimit that
string of keystrokes and somehow know when to stop capturing and start
locating - as opposed to going to "S", then going to "M", then going
to "I" like most combo boxes on web apps seem to.

Nov 12 '05 #5
I just did something like this for an asp page using xml. Here is the
Access version (much simpler).

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Static str1 As String
If KeyCode >= 65 And KeyCode <= 90 Then
str1 = str1 & Chr(KeyCode)
Else
str1 = ""
End If
Me.subfrm.Form.RecordSource = "Select * from Tbl1 Where fldx Like '"
& str1 & "*'"
End Sub

Use the KeyUp event of your textbox. This assumes your subform is in
Datasheet view. I made str1 static. That way you can add characters to
str1 without losing the previous char on each keyup for that textbox.
Then I append a * wildcard. I didn't have to use Static in the xml
version (it was way less fun :). Note: KeyCode will only capture codes
65 through 90 (uppercase chars) even for lower case chars. But Sql
doesn't care - it's all the same.
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #6
Hi Steve,

Try it one more time. I just tried the same link, and it worked fine for me after pasting
it back together.

As an alternative, navigate to MSDN at:
http://msdn.microsoft.com/library/

and then enter the search term:

Make Slow Forms Run Faster

The first hit is that article that you want:

Chapter 8 Excerpt: Make Slow Forms Run Faster (Microsoft Access 2002 Book Excerpts)
Change Access forms to load and display faster. (5 printed pages)
http://msdn.microsoft.com/library/en...okChapter8.asp
Tom

_________________________________________

"Steve" <sp**@nospam.com> wrote in message
news:f0*****************@newsread1.news.atl.earthl ink.net...

Tom,

After pasting the link back together from the word wrap, I get the message the
Page can not be found!

Steve
_________________________________________

"Tom Wickerath" <AOS168 @ comcast . net> wrote in message
news:Hp********@news.boeing.com...
Try the sample available at:
http://msdn.microsoft.com/library/de...nacbk02/html/O DC_CookbookChapter8.asp

_______________________________

"PeteCresswell" <Go**********@FatBelly.com> wrote in message
news:74**************************@posting.google.c om...

I'm looking for some code that makes a list presented in a subform
autoscroll in response to the user typing - like a combo box dropdown
or a regular ListBox does.

I.e. The user is looking at subform that is a list of, say, 2,000
people's names. The first name is "Aardvark, John", and the last name
is "Zero, James".

Instead of scrolling, the user types "S" and is jumped to "Sammons".
Then, on the next keystroke as they type "m", it jumps to "Small", and
after they've typed "i" they're located at the first "Smith". From
the user's perspective, they just typed "smi" without doing anything
else and were magically transported to "Smith".

I've implemented this before, but my code was sort of crude. The
first keystroke popped a dialog, which trapped subsequent keystrokes
and didn't do the locate until the user clicked it's "Locate" button.

Does anybody know of something the more closely duplicates the
existing behavior of MS Access combo box dropdowns/list boxes?

One probem would seem to be able to capture/identify/delimit that
string of keystrokes and somehow know when to stop capturing and start
locating - as opposed to going to "S", then going to "M", then going
to "I" like most combo boxes on web apps seem to.


Nov 12 '05 #7
Thanks, Tom,

The link worked here.

Steve
"Tom Wickerath" <AO***********************@comcast.net> wrote in message
news:mK********************@comcast.com...
Hi Steve,

Try it one more time. I just tried the same link, and it worked fine for me after pasting it back together.

As an alternative, navigate to MSDN at:
http://msdn.microsoft.com/library/

and then enter the search term:

Make Slow Forms Run Faster

The first hit is that article that you want:

Chapter 8 Excerpt: Make Slow Forms Run Faster (Microsoft Access 2002 Book Excerpts) Change Access forms to load and display faster. (5 printed pages)
http://msdn.microsoft.com/library/en...okChapter8.asp
Tom

_________________________________________

"Steve" <sp**@nospam.com> wrote in message
news:f0*****************@newsread1.news.atl.earthl ink.net...

Tom,

After pasting the link back together from the word wrap, I get the message the
Page can not be found!

Steve
_________________________________________

"Tom Wickerath" <AOS168 @ comcast . net> wrote in message
news:Hp********@news.boeing.com...
Try the sample available at:

http://msdn.microsoft.com/library/de...nacbk02/html/O
DC_CookbookChapter8.asp

_______________________________

"PeteCresswell" <Go**********@FatBelly.com> wrote in message
news:74**************************@posting.google.c om...

I'm looking for some code that makes a list presented in a subform
autoscroll in response to the user typing - like a combo box dropdown
or a regular ListBox does.

I.e. The user is looking at subform that is a list of, say, 2,000
people's names. The first name is "Aardvark, John", and the last name
is "Zero, James".

Instead of scrolling, the user types "S" and is jumped to "Sammons".
Then, on the next keystroke as they type "m", it jumps to "Small", and
after they've typed "i" they're located at the first "Smith". From
the user's perspective, they just typed "smi" without doing anything
else and were magically transported to "Smith".

I've implemented this before, but my code was sort of crude. The
first keystroke popped a dialog, which trapped subsequent keystrokes
and didn't do the locate until the user clicked it's "Locate" button.

Does anybody know of something the more closely duplicates the
existing behavior of MS Access combo box dropdowns/list boxes?

One probem would seem to be able to capture/identify/delimit that
string of keystrokes and somehow know when to stop capturing and start
locating - as opposed to going to "S", then going to "M", then going
to "I" like most combo boxes on web apps seem to.


Nov 12 '05 #8
RE/
I just did something like this for an asp page using xml. Here is the
Access version (much simpler).

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Static str1 As String
If KeyCode >= 65 And KeyCode <= 90 Then
str1 = str1 & Chr(KeyCode)
Else
str1 = ""
End If
Me.subfrm.Form.RecordSource = "Select * from Tbl1 Where fldx Like '"
& str1 & "*'"
End Sub


Thanks all.

I abandoned the idea of trying to do it without a form to capture keystrokes -
seemed too complicated to tell where the stroke string ended....(maybe via some
kind of TickCount calc...)

Anyhow, what I did was use KeyPress to capture the first stroke, then pass it to
a modal dialog that consisted of just a single text box.

After copying .OpenArgs into the textbox and doing a .SelSet I used the text
box's KeyPress to capture subsequent keystrokes and trap for Return/Enter.
Once the user hits one of those, I copy the complete captured string to a global
variable, close the form, and return control to the calling routine (the list's
KeyPress).

The list's KeyPress then checks the string to see if there's anything in it,
opens up a .RecordsetClone, finds a record, grabs the .BookMark, and sets the
form's .BookMark.

The two problems I had were:

1) Getting it through my head that KeyDown wasn't going to work as easily
because I'd have to case out on the numeric keypad - whereas KeyPress gives me
the ASCII value regardless of what key the user pressed.

2) Biting the bullet and filtering those ASCII characters down to the real-world
possibilities.
--
PeteCresswell
Nov 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Robert | last post: by
3 posts views Thread by Phil | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.