Well, yes, the code is use-less. I created it just to demonstrate the problem. The actual code does do some stuff to other forms when unloading. I do want to exit the form, hence cancel=true is not an option.
You have the following code in your Form_Unload event:
If you change the field name without updating the form design to match it, you will get error 2465: Microsoft Access can't find the field '|1' referred to in your expressionCode:Private Sub Form_Unload(Cancel As Integer) If [VersId] = 1 Then End If End Sub
This will of course prevent you closing the form unless you update the code to match the new field name
However the code is pointless as written. Adding the line Cancel = True after Then will prevent the form closing without raising an error
Works fine for me as well.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
My database uses Arabic text while Access does not natively handle Arabic. I can have it in the tables and data, but can't write Arabic in queries, or VBA. So I changed the "System Locale" on one of my computers to Arabic language. That enabled me to use Arabic in VBA and in queries, but then I started seeing some weird problems like this one and when I tried to convert from Access to SQL server, the conversion tool did not even recognize the tables in by DB. So I had to changed "System Locale" back to English, and recreate all the tables. So now the conversion tool worked. I am still having this runtime problem when I switch to design mode, but I believe, it will get fixed if I recreate the form and those tables. Have not tried yet because this is not show stopper for me. Thanks everyone for your time and input.
![]()