List Box no refresh

eoctopus

New member
Local time
Yesterday, 16:16
Joined
Aug 25, 2006
Messages
3
List Box Not Refreshing

:confused: I have a listbox which using "Table/Query" RowSourceType lists all records in table of Access 2003. The Add Record button clicked, a new record will be inserted to table, and then requery listbox.
But it's so strange, the record already existed in table, but listbox still doesn't refresh after requery, I have to presss F9 several times to refresh manually. The update record button clicked, the listbox doesn't refresh too, but when I check the value of the row, the value is new value, but ths listbox on screen shows old value. for deleting, has the same problem.

So I'm not sure, if this is a bug of Access, or I missed something have to do. I already tried many way to solve this problem (sleeping, check if updated listbox, etc), all of them aren't work well.

Please give me a help!!!

Michael

I have a listbox which using "Table/Query" RowSourceType lists all records in table of Access 2003. The Add Record button clicked, a new record will be inserted to table, and then listbox will be requery to show updated table.
But it's so strange, the record already existed in table, but listbox still doesn't refresh after requery, I have to presss F9 several times to refresh manually. The update record button clicked, the listbox doesn't refresh too, but when I check the value of the row, the value is new value, but ths listbox on screen shows old value. for deleting, has the same problem.

So I'm not sure, if this is a bug of Access, or I missed something have to do. I already tried many way to solve this problem (sleeping, check if updated listbox, etc), all of them aren't work well.

Please give me a help!!!

Michael

I did it, but it didn't work. Ever I looped 10 times.

mousemat said:
you could try requerying the list box on the onclick event of the Add record Button

Code:
listboxname.Requery

I did it, but it didn't work. Ever I looped 10 times.

mousemat said:
you could try requerying the list box on the onclick event of the Add record Button

Code:
listboxname.Requery

Thanks for you help. My code is

With Me.lstISG
.RowSourceType = "Table/Query"
.RowSource = "SELECT * FROM InternalServiceGoal WHERE Year='" & Trim(lstYear.Value) & "' ORDER BY Year, Department, Service_Category, Service_Category_Details, Objective, Measure;"
.Requery
.SetFocus
.ListIndex = -1
End With

Add button and ListBox on same Form. Add button captures text fileds and insert a record to database, ListBox just display all the records after click Add/Update/Delete button. All of three buttons clicked, the ListBox (lstISG) will be requery. but it doesn't work, I have to presss F9 several times to refresh the Form.
 
Last edited by a moderator:
you could try requerying the list box on the onclick event of the Add record Button

Code:
listboxname.Requery
 
Requery or Recalc...I always forget...

It might be form.Recalc instead. I always forget which does which.

If that doesn't work, could you trace the process for me? I'm confused as to where you are writing the data and from where you are reading the data. Is it the same Table--directly from the table or is there a query between? Is it a Form or Table that is using the list box? Etc.

jason.
 

Users who are viewing this thread

Back
Top Bottom