PDA

View Full Version : Userform problem : makes excel crash



Paul_90
06-09-2020, 12:29 PM
Hello everyone I’m new at VBA and this is my first big project, I’ve got this userform that I want to use for client’s interviews.

The infos are then sent to a database with the option to edit. The problem is that if I enter a new client values and quit & SAVE excel, then reopen excel and the userform, the moment I click on « continue », excel crashes with this error message « Automation error The object invoked has disconnected from its clients » (althought the error message doesn’t always pop).

This problem is reproduced on other computers and excel versions (I have 2013).It’s odd that the first use of the userform works, but the other times (after saving) cause excel to crash. Is it possible that I have too many controls? Does the order of the controls in the userform needs to be the same as the database? Infinite loop possibilities?

Is there any better way (with coding) to get a userform / database with this many controls and with the possibility to edit? If yes can you give me any cues, ressources, examples I can start with?I’ve tried to restart on a blank workbook with copying only the content and recreating the userform, but the problem persist.

I’ve done an excel repair too. For your information, I’ve inspired myself from « Tiger spreadsheet solution » on youtube for my userformDo you have any cues?

Thanks

snb
06-10-2020, 01:48 AM
1. Do not use datepicker or montview controls.
2. in a worksheet: always use cell A1
3. Do not start a listobject in another cell than A1
4. Use a combobox (style=2) filled with valid data, insted of a textbox that has to be 'tested' in a 'class'; see https://www.snb-vba.eu/VBA_Fill_combobox_listbox_en.html#L_5.4.1
5. refrain form refedit controls.
6. integrate the filter routine in the 'new' userform
7. check VBEditor, tools, references

Paul_90
06-10-2020, 12:36 PM
Thank you for your answer. I'll try that. :yes