![]() |
Listbox update on command
Hello guru's,
I have a listbox displayed in a form filled through the row source in properties (a named offset). When the user adds data to a textbox then hits the add button it goes to the database. The form remains open and i would like to have the listbox update with the new information immediately instead of showing the added data when i reactivate the form. Help. -- Thank you, Jennifer |
Listbox update on command
My take on "a named offset" was that your database is a *dynamic named range*
and that the rowsource is the same (references by name). This may be completely wrong. However, your post suggests that adding to the database (row source) is not the problem. Just updating the listbox to reflect it. All you need to do to get the list box to update is to just state that the rowsource is the name of the range. Simplified example code: Private Sub CommandButton1_Click() With Range("Database") .Cells(.Cells.Count + 1).Value = TextBox1.Text End With ListBox1.RowSource = "Database" End Sub Regards, Greg "Jennifer" wrote: Hello guru's, I have a listbox displayed in a form filled through the row source in properties (a named offset). When the user adds data to a textbox then hits the add button it goes to the database. The form remains open and i would like to have the listbox update with the new information immediately instead of showing the added data when i reactivate the form. Help. -- Thank you, Jennifer |
Listbox update on command
So easy . . . my brain just isn't working that way tonight. Thanks!
-- Thank you, Jennifer "Greg Wilson" wrote: My take on "a named offset" was that your database is a *dynamic named range* and that the rowsource is the same (references by name). This may be completely wrong. However, your post suggests that adding to the database (row source) is not the problem. Just updating the listbox to reflect it. All you need to do to get the list box to update is to just state that the rowsource is the name of the range. Simplified example code: Private Sub CommandButton1_Click() With Range("Database") .Cells(.Cells.Count + 1).Value = TextBox1.Text End With ListBox1.RowSource = "Database" End Sub Regards, Greg "Jennifer" wrote: Hello guru's, I have a listbox displayed in a form filled through the row source in properties (a named offset). When the user adds data to a textbox then hits the add button it goes to the database. The form remains open and i would like to have the listbox update with the new information immediately instead of showing the added data when i reactivate the form. Help. -- Thank you, Jennifer |
All times are GMT +1. The time now is 06:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com