change the chosen record in a listbox

tomro1

Registered User.
Local time
Today, 15:49
Joined
Jun 12, 2006
Messages
23
Hi all,

I have a listbox with a rowsource linked to a table.

Table: ID, FLDname, FLDplace( 1,2,3,....)

Now, when I choose a record in the listbox, I have 2 buttons. One up, One down. The point is that if I click "UP" that the fldplace changes form 17 to 16 for example, and then requerys.

now, that all works perfectly.. The catch is that I want to move the .listindex also 1 up, cause thats where the moved record is now placed.

Problem is that if i try something like, listindex = listindex + 1 .. it does not work..

Does anyone know how it could work??

And also, everytime i "up" my record, I get a message "the data has been changed".. How can I turn this off?
 
- I believe you can select an item in a listbox by setting the value property of the control, so if you save that value elsewhere before you do your move, and then reassign that value to the control after the requery, that might work.
- My guess about the write confict is that the listbox is bound to a field in recordsource of the form. If you then programmatically edit that same record in the table you have two pending edits on the same data, and Access lets you know. To make that work you may need to use an unbound listbox, and then programtically save that result to the table when your list re-ordering operations are completed.
- Hope this offers you some ideas about how to proceed.
 

Users who are viewing this thread

Back
Top Bottom