Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox won't scroll when form is loaded 1

Status
Not open for further replies.

chiuchimuN

Programmer
Apr 24, 2002
29
US
I have a bound listbox in Access2000 that only scrolls after another control gets the focus. I tried passing the focus to another control by code but it doesn't work. I have to click another control by mouse to enable the listbox to scroll. How do I fix this?

Also, I would like the listbox to scroll down by code as I'm adding data to it because I want to see that its correct. Is there a simply way of doing this?
 
You might consider uploading the listbox from another object...don't quite understand what problem you're having with the listbox not scrolling.
 
After the for loads, If I try to grab the scrollbar tab It won't move. But if I click a button or type into a textbox first before using the scrollbar then try the srcollbar it works.
 
On the On Open event of the Form try this:

Forms![frmMyForm]![MyListbox].Requery

and see if that activates it...sometimes too the object "self-destructs" for God knows what reason and so I have found a few times along the way that to just introduce a new object(listbox) may solve the problem. Recheck your property sheet too for the listbox and make sure there's nothing there that might be interfering.
 
Tried removing the listbox and then creating a new one but this didn't work. Also tried open event but this didn't work. I'm loading the rowsource property with an SQL statement but this couldn't be the problem

SQLStr="SELECT ID,Name,Info FROM TABLE1 ORDER BY Name"
 
Kurage --

I didn't read completely your problem, I was thinking you were having some type of mechanical problem with the listbox. I'm a bit confused. You have a list box, using an SQL statement that calls up 3 columns. I suppose you're showing all columns (Column ct = 3, Bound Column = one of the three, etc..)

Now, if you do that your form should be over the underlying table's recordset and the current record should have that's records information highlighted in the listbox. I don't believe you can "enter" data into this listbox, its a non-editible window. I assume these three fields displayed in the list box are in the same table as the rest of the records on the form, although that really shouldn't make any difference.

You can load up new information from another object (pop up form or textbox, etc...) and requery the list box in the AfterUpdate event and "see" during run time the new addition to the list box but I don't think you can work via editing directly in the list box. Why your listbox doesn't scroll is a mystery to me as I have not ran into that problem and can't think of a single property that would affect that.

I don't mind helping you, and perhaps someone will drop by and "see the light" -- perhaps a bit more clarification would help. As a last resort you could try backing up the database by importing all your objects into a blank database and "refreshing" the platfrom so to speak.
 
Listbox is bound to table. What I meant about adding data was to a different table. I'll try to clearify what the application does.

The form takes daily attendance by using a barcode scanner. Input from scanner is a ID number that is used to look up info in Table( Currentely enrolled,payment status..). If the scanner can't read the barcode or a barcode is not available, I want the user to be able to input a ID and lookup the current students from the listbox.

I saw another post on this forum that said a simular thing. Is this just how VBA listbox behave?
 
Kurage -- shd be easy enough. If the vba code returns a "null" for ID, and the User then has to add it -- the first thing that comes to mind is to have a combo box available that is, say, disenabled until the Null value is returned, then enables itself, with focus set there, and user then selects the proper ID, from multiple columns of information (Name, ID, etc...) and then the DLookUp occurs and Table 2 is then populated with the correct information. I would abandon the notion of editing within the list box itself - however, I use many routines which a selection is made in the list box, or clicked on, which then sets into motion the various tasks required.

If you'd like I could scratch out some code for you just to get on the same track together...what you're trying to do is doable, just have to get things clarified.
 
Solved it! Bizarre! I replaced the listbox with a listview to see if this changed things. Even with the listview I still got scroll locked. I set the "tab stop" property to true and now the thing works fine!


Why this property should cause scroll locking..who knows.

Thanks for your time and effort helping me Isadore. I might change my design to use a combobox that desplays a match as a user types info.
 
Kurage - Great! We both learned something on this one! Good Luck, and we'll be seeing ya around - I got the impression that you were being very deligent and obvisouly knowledable about what you were doing...like you, I'd have never guessed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top