I have a button on a form that opens a pop up form. I do this by using the DoCmd.OpenForm
command in the on click event of the button. When I click the button on the form access crashes without error message or any type of crash report. When I open the debugging window and then click the button, the form opens as intended and there is no crash. I have dozens of buttons that open similar pop up forms, in fact most of them I just copied, pasted, renamed and adjusted some of the field references, inlcuding this one. Only one has this issue. It pretty much crashes every single time, unless I open the debugger first. The form is for new data entry. The data entry form has one main form, and a subform on it. The main form and subform are not linked, it´s mostly for design purposes. The main form has no elements apart from the subform and an unbound label in the header I use as a title. The subform has a textbox that is linked to a table element. Compress and repair does not help. The strange thing is that it works just fine if I first open the debugging window, if I don´t it just crashes. So I can't even figure out where it goes wrong, since it never does when debuggin is on, but I guess it's on the OpenForm and not the button click. No Idea what`s going on. I made a new form and deleted the old one, but got the same issue... Maybe some access bug I am not aware of?
Code for the button:
Private Sub Befehl2_Click()
DoCmd.OpenForm "neukategorie"
End Sub
All code that can be found on the subform of the pop up (one accept and one cancel button, nothing else with code on there):
Button cancel:
Private Sub Befehl11_Click()
If Me.Dirty = True Then Me.Undo
DoCmd.Close acForm, "neukategorie", acSaveNo
End Sub
Button accept:
Private Sub Befehl12_Click()
RunCommand acCmdSaveRecord
Me.Requery
MsgBox "Neue Kategorie wurde gespeichert"
DoCmd.Close acForm, "neukategorie", acSaveNo
End Sub
The textbox for data entry is linked to kategorie
in the table kategorie_tabelle
all the way on the left:
My Access version:
Version 2205 Build 16.0.15225.20028
My Windows install:
Microsoft Windows 10 Pro
10.0.19044 Build 19044