473,320 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 2413
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Donna Sabol | last post by:
I have a form (frm_MAIN_RPT) that contains a combo box (Combo6) & subform (dbo_REQ_subform). The combo box is used to select the "cost center" data that will be displayed in the subform. From...
2
by: Kelly | last post by:
I have a subform that display requisition information. One of the fields in the subform is a combo box that shows who requested the requisition. The users can change who requested the requisition...
2
by: Robert | last post by:
Am using a nested continuous bound subform to add multiple records to the underlying table. One of the fields is based on a limit to list combo box. Any suggestions on best way to progressively...
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
9
by: natwong | last post by:
Hi All, I'm a newbie in terms of Access and some of its functionality . I've been stuck on this problem for a couple days, even after searching the Web, etc. Currently I have five combo boxes...
3
by: Phil | last post by:
I've posted this a few times without any luck, hoping for some fresh ideas on this. I'm pretty certain this can be done. I've been using a micrsoft template to create a supplier database called...
4
by: virtualgreek | last post by:
Dear All, First of all I would like to take the time to thank you all for your efforts and time spent at this wonderful forum. I have found it very helpful with numerous examples available for...
1
by: lawton | last post by:
Source: this is an access 2003 question My knowledge level: reading books, internet, and trial & error; no formal training I'm trying to get a running sum of what's filtered in a subform which is...
14
kcdoell
by: kcdoell | last post by:
Hello: I have a form (Default view =single form) with a subform (Default view =continuous forms) embedded into it. In the form I have three controls that display the Division, Working Region &...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.