Hi All,
I'm having trouble updating the contents of a listbox. I have a form and users select a file, a sql server stored procedure is then called and the filepath is saved to a table on the sql server and the filename is then added to the listbox. This works fine and the listbox refreshes and displays the added file name after each file is added. However, I have a problem when I try and delete from the listbox. A user will select the item from the listbox they want to delete and click 'delete'. A sql server stored procedure is called and the selected entry in the sql server table is deleted, then the contents of the table (minus the record just deleted) are returned to access and this is the source of the listbox. I return the results of the sql server stored procedure into a recordset and make this the source of the listbox. However, the listbox doesn't reflect these changes until the form is closed and reopened. I've tried..
but it doesn't work.
doesn't work either because the 'Row source type' is 'table/query'
Does anyone have any suggestions on how to refresh the listbox without having to close the form?
Thanks in advance
I'm having trouble updating the contents of a listbox. I have a form and users select a file, a sql server stored procedure is then called and the filepath is saved to a table on the sql server and the filename is then added to the listbox. This works fine and the listbox refreshes and displays the added file name after each file is added. However, I have a problem when I try and delete from the listbox. A user will select the item from the listbox they want to delete and click 'delete'. A sql server stored procedure is called and the selected entry in the sql server table is deleted, then the contents of the table (minus the record just deleted) are returned to access and this is the source of the listbox. I return the results of the sql server stored procedure into a recordset and make this the source of the listbox. However, the listbox doesn't reflect these changes until the form is closed and reopened. I've tried..
Code:
Me.listbox_name.requery
but it doesn't work.
Code:
me.listbox_name.RemoveItem
Does anyone have any suggestions on how to refresh the listbox without having to close the form?
Thanks in advance