Scroll a subform based on a letter typed

48 Views Asked by At

I have a form, mainForm. In addition to a bunch of text boxes, the user needs to select a row from a sub form (subForm) which is in mainForm. SubForm gets its data from a query, subFormQuery. The subForm is in DataSheet View, so it looks like a table.

I'd like the user to be able to press a key when the subForm has the focus and have it scroll to the first item that matches the letter the user pressed. It doesn't need to go past the first letter pressed. Also, if it matters the view is alphabetical.

I'm used the KeyDown event, and I can capture the code. But I don't know how to make the subForm scroll. Also, it's okay if the user needs to press the key when the focus is on a text box in the subForm. I'm not looking for perfection. Also, I'm the user, I'm building this for myself, and I just want to be able to get near the correct row more quickly.

1

There are 1 best solutions below

0
Mitchell Kaplan On

I wound up doing something a little different, but it was fairly easy. I added a text box to the main form, right after the sub form - textB. I added a condition to the query on which the sub form was based. That query used textB with a Like condition. This filtered the sub form to only those items beginning with the letter in textB.

Not exactly what I had asked, but it took care of my problem and enabled me to find the row I need quickly.