Not empty list wiev at Formload

Ma_Ster

New member
Local time
Today, 13:12
Joined
Oct 29, 2013
Messages
4
I have created a form with a list view (active-x) to be able to control colors, etc in a list.
Unfortunately, I have encountered a problem for which I can not find any solution

When I open my form, it is already information (three rows) in the list view. This despite the fact that I have shut down the access application and even shifted the database to another computer.

I can of course delete the elements with ListItems.Clear when I open the form, but I'd rather like that they did not show up at all.

Anyone have any idea where these "default-elements" are stored, so I can remove them from the list wiev once and for all?
 
If you open the Form in Design View and select the listbox, bring up the Property Sheet.

Is there an Items/List Property that contains values?

--
Are you setting the Data Source to a Table/Query or is it a Static list.
Is this being populated manually by the user or in code after the form has loaded?
 
Hello Alex!

Thank you for answering!

Since “ListView” is an active-x control (using mscomctl.ocx) it differs a bit from the ordinary listbox. The ListView does not have a RowSource property like the ListBox. ListItems must be loaded into it one at a time using VB code. There are no visable property in the property sheet that holds the data I want to get rid of.

I’ve also, to be certain that no VBA-code could be the reason for these items showing up at start, made a copy of the form and deleted all the code associated – but when opening the form, the data still remains.

I wear my hair in frustration over where this is stored. As I move around the database from one PC to another on a memory stick and the behavior is the same everywhere, it can hardly be in the registry either.

// Magnus
 
I can of course delete the elements with ListItems.Clear
Do this but place a STOP statement after the code.
Stop the code (from the toolbar) and save the form.
Is this help you ?
 
Or remove the entire control from your form and insert a new one. Give it the exact same name and restore the links for events.
 
Thank you Mihail!

Remove and insert a new identical list view solves the problem short term (I've tried and verified). The bad side of it is that I have a feeling that this might happen again. In that case I'm back to square one, since recreating the list view over and over again is a bit annoying.

Anyway, thank you a lot for input and solution.
 
The bad side of it is that I have a feeling that this might happen again.
I don't think so but... is not impossible.
Avoid to save the form at run time or at (semi) run time. I say (semi) because I haven't a true word in my English:
From the design view you run the form. This is usually called "run time". At this moment you can switch to a (semi) run time that allow you to move and resize controls to better fit in your form or to the information. If you try to close the form now (or after you switch again to the run time, Access ask you to save it. DO NOT do that. DO NOT save while the form is in run time or in (semi) run time. Switch to design view then you can save safely.
The same if you debug the code. If you place a break point then you modify something in the code, by instinct you press CTRL+S or you press the Save button. DO NOT do this.

Keep in mind: Save a form ONLY if the form is in design view.

One more thing: A third part controls are not (usually) as stable as the native controls. This is true for any application, not only for Access.

Good luck !
 

Users who are viewing this thread

Back
Top Bottom