Nov 10 2020 09:05 AM
Nov 10 2020 09:05 AM
I have a listbox I have doing two things. It filters criteria based on a Textbox.Text with an OnChange event. Code works beautifully individually! Plenty of tutorials using a WHERE in an SQL statement for the listbox source.
In this same Listbox I use a OnDblClick event to open a form and filter for the selected item using the Listbox.Column() property to forward the value to WHERE criteria of the opened form. Code also works beautifully individually.
Here is my problem, say I do a search in the textbox and this filters the records of the listbox. For some odd reason I can no longer grab a value of the selected item in the listbox. Further, if I right-click to copy the field it gives me a error telling me "there isn't enough memory" which is absurd thinking the data is a few bytes on a 16GB RAM memory system.
I'm scratching my head on this one for a couple of days. I tried Listbox.Value even.....doesn't matter! Again, the code works as desired individually, but I have no way of pulling data from the listbox once I apply a filter to its contents based on a form's textbox.
Nov 10 2020 09:20 AM - edited Nov 10 2020 09:21 AM
@AmedMesa Hello, Amed, just a quick thought on the memory message. This may be obvious, but have you restarted your computer? I have found in previous versions of Access and on O/S before Win 10 (which I am only starting to use these past couple of weeks) that sometimes my computer would get "tired" and require a reboot. I've frequently encountered situations where MS Access would not even start, citing "not enough memory". Restarting the computer has always made such memory error messages disappear.
Nov 10 2020 09:30 AM
Appreciate the response. I don't think it is my computer given I have done this on two entirely different PCs. I have repeated this error using the same coding but written in separate db files individually. Negates a file corruption question.
When I close the form I can use the OnDblClick event on the listbox as intended to pass through the selected item to the WHERE clause of the SQL statement in the other form.
I get this problem when I apply a filter to the listbox based on the TextBox.Text on the OnChange event. Again, it filters the items perfectly. But, once I filter it I cannot copy the contents of what I select, though I can select any item on that list as normal. It just does not update the object properties it seems. Its blank. the ListBox.Value or .Column() is empty no-matter what.