Hallo,
ich machte mit einem Kontextmenü Access beenden. Dazu habe ich in ein Modul geschrieben:
Function beenden () Forms![polju].ShortcutMenu = False 'Forms![polju].SetFocus 'DoCmd.Close 'Cancel = True 'DoCmd.OpenForm "Polju" For i = 0 To Forms.Count - 1 DoCmd.Close acForm, Forms(i).Name Next Application.Quit 'Resume Next End Function
Im For,ular bei Form load
Dim customBar As CommandBar Dim newButton As CommandBarButton Dim X As Variant Me.ShortcutMenuBar = "TestContext" If BarFind("TestContext") = True Then CommandBars("TestContext").Delete Set customBar = CommandBars.Add("TestContext", msoBarPopup, False, False) With customBar" X = "BEENDEN!" .Controls.Add(msoControlButton, , , , True).Caption = X .Controls(X).OnAction = "beenden" End With
Ich erhalte den Laufzeitfehler 2406 Aktion oder Befehl derzeit nicht verfügbar.
Die auskommentierten Teile sollen auf Versuche hindeuten, ich nicht zu einer Fehlerbehebung führten.