Access form ListBox Vertical ScrollBar

I have a listbox on a form which has over a 1000 names listed on it.
When I drag the vertical scrollbar down I would like to see the data move with it.

Can an expert suggest how to do this please.
LVL 1
PeterWhittsAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Commented:
create an unbound Textbox, txtCompanySearch

place this codes in the change event of the textbox

private sub txtCompanySearch_change()
dim db as dao.database, rs as dao.recordset, sql as string
sql="select distinct Company FROM tblCustomers where company like '" & me.txtCompanysearch.text & "*'"

set rs=db.openrecordset(sql,dbopensnapshot)
if rs.recordcount>0 then
  rs.movefirst
  me.listboxName=rs!company   '< change listboxname to actual name
end if
rs.close
db.close
end sub
0
 
Rey Obrero (Capricorn1)Commented:
that is weird.. i got a listbox with more than that and the list shows as  you drag the v scrollbar..

can you try creating a new form, place a listbox and use the same rowsource. see if it will behave the same
0
 
PeterWhittsAuthor Commented:
Same result.  I am using the following....by the way ...the record count  should have read 10,000 not 1000 and the list is showing unique records

SELECT DISTINCT tblCustomers.Company FROM tblCustomers WHERE (((tblCustomers.Company) Is Not Null)) ORDER BY tblCustomers.Company;


Using PageDown gets a move on but the scroll bar has very little affect....does it have a scale I can change
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Rey Obrero (Capricorn1)Commented:
the only scale i could think of is the Grid X and Grid Y property of the form...

here is work around to limit the amount of records to display

http://allenbrowne.com/ser-32.html

0
 
Rey Obrero (Capricorn1)Commented:
oops sorry, that is for a combo box not a listbox..
0
 
Rey Obrero (Capricorn1)Commented:
do you want a listbox that narrows the selection when you type characters in an unbound Textbox?, like the one in address book of outlook.
0
 
PeterWhittsAuthor Commented:
that would be useful...yes please
0
 
PeterWhittsAuthor Commented:
Thanks for that.

I get a rte 91 "Object variable with Block variable not set"  against

Set rs = db.OpenRecordset(sql, dbOpenSnapshot)

:~(
0
 
Rey Obrero (Capricorn1)Commented:
oops

set db=currentdb
Set rs = db.OpenRecordset(sql, dbOpenSnapshot)
0
 
PeterWhittsAuthor Commented:
unfortunately the list isnt changing although the code seems to work carrying the variable through ok on a break point and F8
0
 
Rey Obrero (Capricorn1)Commented:
can you upload a copy of your db?
0
 
PeterWhittsAuthor Commented:
unable as too much confidential stuff
0
 
PeterWhittsAuthor Commented:
can you present a small working example?
0
 
Rey Obrero (Capricorn1)Commented:
0
 
PeterWhittsAuthor Commented:
Fine now....took a screen dump of your settings and compared them to mine...must have changed some in trying to get it to work...but now ok.

If it is not too much bother, is there a way of getting the focused record in the middle of the listbox as it is always at the bottom.

Many thanks for your help so far.
0
 
PeterWhittsAuthor Commented:
I will add the extra question as a new question..many thanks for your help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.