I am trying to clear the Row Source of a list on my form as the access file closes. I cannot get it to work. What am I doing wrong?
Code:Public Sub Form_Unload() List17.RowSourceType = "" List17.RowSource = "" List17.Requery End Sub
I am trying to clear the Row Source of a list on my form as the access file closes. I cannot get it to work. What am I doing wrong?
Code:Public Sub Form_Unload() List17.RowSourceType = "" List17.RowSource = "" List17.Requery End Sub
What happens? You'd have to save the form. I'd be more likely to have the first 2 lines in the open event of the form, if your goal is that it be blank when the form opens.
So when I open my access file, an error occurs because the list rowsource points to a table that does not yet exist. This table gets created by a load file button via transferspeadsheet. After the table is created the list becomes populated. At the end of my process, I delete the table because a new file will be loaded on next run. So each time I either open/close the database file I need to clear out the rowsource? What is the best way to do this?
Simplest is probably no code, just delete the row source in design view and save the form. That way it has no source when it opens. Then you can set it at the appropriate time. As a rule, I'd empty/repopulate a table rather than delete/recreate.
Thanks. However I cannot empty and repopulate as each time a run the process, a different file with a different number of fields is loaded.
I understand. Try that code in the open event.