2017-02-11 4 views
1

Gibt es eine Möglichkeit, einen Ereignisteilnehmer in das direkte Fenster (z. B. Debug.Print) in VBA unter Microsoft Access für das Debuggen zu haben? Dieser CodeEreignis-Abonnent in Microsoft Access VBA

+0

Nein. Das Direktfenster ist im Grunde eine Konsole und es enthält nicht einmal ein Steuerelement für die Anzeige von Text - es wird direkt auf den Clientbereich gezeichnet. Sie müssten in der Lage sein, die IO direkt vom Debugger zu haken. VBA \ 6 Programmierer haben dies seit Jahrzehnten mit keinem Erfolg versucht ... – Comintern

+0

Abonnieren Sie welche Veranstaltungen? Sehen Sie sich das Schlüsselwort 'WithEvents' an, das bei der Deklaration von Variablen verwendet wird, z. 'Dim WithEvents foo als Access.Form' –

Antwort

1

ist ein One-Stop für alle Microsoft Access emittierende Objekte ...

Option Explicit 
'* In a class module 

Private WithEvents o_PageEvents As Access.Page 
Private WithEvents o__ControlInReportEvents As Access.[_ControlInReportEvents] 
Private WithEvents o_LabelEvents As Access.Label 
Private WithEvents o_RectangleEvents As Access.Rectangle 
Private WithEvents o_LineEvents As Access.Line 
Private WithEvents o_ImageEvents As Access.Image 
Private WithEvents o_CommandButtonEvents As Access.CommandButton 
Private WithEvents o_OptionButtonEvents As Access.OptionButton 
Private WithEvents o_OptionButtonInOptionEvents As Access.[_OptionButtonInOption] 
Private WithEvents o_CheckBoxEvents As Access.CheckBox 
Private WithEvents o_CheckBoxInOptionEvents As Access.[_CheckBoxInOption] 
Private WithEvents o_OptionGroupEvents As Access.OptionGroup 
Private WithEvents o_BoundObjectFrameEvents As Access.BoundObjectFrame 
Private WithEvents o_TextBoxEvents As Access.TextBox 
Private WithEvents o_ListBoxEvents As Access.ListBox 
Private WithEvents o_ComboBoxEvents As Access.ComboBox 
Private WithEvents o_ObjectFrameEvents As Access.ObjectFrame 
Private WithEvents o_PageBreakEvents As Access.PageBreak 
Private WithEvents o_ToggleButtonEvents As Access.ToggleButton 
Private WithEvents o_ToggleButtonInOptionEvents As Access.[_ToggleButtonInOption] 
Private WithEvents o_PaletteButtonEvents As Access.PaletteButton 
Private WithEvents o_SubFormEvents As Access.SubForm 
Private WithEvents o_SubReportEvents As Access.SubReport 
Private WithEvents o_CustomControlEvents As Access.CustomControl 
Private WithEvents o_CustomControlInReportEvents As Access.[_CustomControlInReport] 
Private WithEvents o_TabControlEvents As Access.TabControl 
Private WithEvents o_SectionEvents As Access.Section 
Private WithEvents o_SectionInReportEvents As Access.[_SectionInReport] 
Private WithEvents o_PageHdrFtrInReportEvents As Access.[_PageHdrFtrInReport] 
Private WithEvents o_FormEvents As Access.Form 
Private WithEvents o_ReportEvents As Access.Report 
Private WithEvents o_References_Events As Access.References 
Private WithEvents oDispAttachmentEvents As Access.Attachment 
Private WithEvents oDispEmptyCellEvents As Access.EmptyCell 
Private WithEvents oDispWebBrowserControlEvents As Access.WebBrowserControl 
Private WithEvents oDispNavigationButtonEvents As Access.NavigationButton 
Private WithEvents oDispNavigationControlEvents As Access.NavigationControl 

Einige Beispiele für ihre Verwendung sind in diesen Verbindungen erhalten | Adding Classes WithEvents to MS Access Form | MS Access WithEvents in Class Module for OnClick Event |.

Auch ein Stack Overflow ähnlicher Frage Click event handler withevents

+0

@S Meaden Vielen Dank für Ihre Antwort. Entschuldigen Sie, wenn das eine triviale Frage ist, aber ich bin immer noch verwirrt darüber, wie ich das obige Code-Snippet verwenden würde, um zB alle Ereignisse auszugeben, die von einem bestimmten Objekt ausgelöst werden, indem Sie seine Referenz übergeben. Würde es Ihnen etwas ausmachen, die Antwort mit einem Beispiel zu aktualisieren? Ich würde das sehr schätzen. – falhumai

+0

Normalerweise mache ich Access nicht und konnte es nicht sofort zum Laufen bringen. Ich habe einige Links eingefügt, die Beispiele zeigen. –

+0

Vielen Dank !! – falhumai