Macro don't work at start (1 Viewer)

georg7

Registered User.
Local time
Today, 14:12
Joined
Sep 3, 2019
Messages
84
Hi guys, everytime I start my db and want to start a macro this error pops up: "You have selected the expression ~ on click ~ as the setting for the event property. This printed caused an error. Object or class do not support this set of Events". My solution at the Moment is to switch to the Access design view and go back- now it works….
This is the Code that triggers the error:
Code:
Option Compare Database

Private Sub Befehl16_Click()
Me!sf_qry_all.Form.FilterOn = False
End Sub

Private Sub Kombinationsfeld2_Click()
    Me!sf_qry_all.Form.Filter = "Gruppe = '" & Me.Kombinationsfeld2 & "'"
    Me!sf_qry_all.Form.FilterOn = True
    Me.Kombinationsfeld2 = Null
End Sub

Private Sub Kombinationsfeld4_Click()
Me!sf_qry_all.Form.Filter = "Kategorie = '" & Me.Kombinationsfeld4 & "'"
    Me!sf_qry_all.Form.FilterOn = True
    Me.Kombinationsfeld4 = Null
End Sub

Private Sub Kombinationsfeld6_Click()
Me!sf_qry_all.Form.Filter = "Schulung = '" & Me.Kombinationsfeld6 & "'"
    Me!sf_qry_all.Form.FilterOn = True
    Me.Kombinationsfeld6 = Null
End Sub

Private Sub Kombinationsfeld8_Click()
Me!sf_qry_all.Form.Filter = "Schulung = '" & Me.Kombinationsfeld8 & "'"
    Me!sf_qry_all.Form.FilterOn = True
    Me.Kombinationsfeld8 = Null
End Sub
Private Sub Kontrollkästchen21_Click()
Me!sf_qry_all.Form.Filter = "[Nächster Termin] >= #" & Format(Date, "mm\/dd\/yyyy") & "# and [Nächster Termin] <=#" & Format(Date + 30, "mm\/dd\/yyyy") & "#"
    Me!sf_qry_all.Form.FilterOn = True
    Me.Kontrollkästchen21 = Null
End Sub

Private Sub Kontrollkästchen24_Click()
Me!sf_qry_all.Form.Filter = "[Nächster Termin] <= #" & Format(Date, "mm\/dd\/yyyy") & "#"
    Me!sf_qry_all.Form.FilterOn = True
    Me.Kontrollkästchen24 = Null
End Sub

Private Sub Text26_AfterUpdate()
Me!sf_qry_all.Form.Filter = "Nachname = '" & Me.Text26 & "'"
    Me!sf_qry_all.Form.FilterOn = True
    Me.Text26 = Null
End Sub
 

bob fitz

AWF VIP
Local time
Today, 22:12
Joined
May 23, 2011
Messages
4,165
I don't understand.
....everytime I start my db and want to start a macro this error pops up: ....
what you are showing us is code, not a macro.

Which line causes the error.

BTY
You should always have:
Option Explicit

as the second line of code in a code module, below the line:
Option Compare Database
 

georg7

Registered User.
Local time
Today, 14:12
Joined
Sep 3, 2019
Messages
84
Sorry macro was the wrong word. When I start my db and press one of those Buttons it triggers the error. Which line causes the error is not shown.
 

georg7

Registered User.
Local time
Today, 14:12
Joined
Sep 3, 2019
Messages
84
So I wanted to make some screenshots for you and now it works… I don't get it haven't edit anything....
 

bob fitz

AWF VIP
Local time
Today, 22:12
Joined
May 23, 2011
Messages
4,165
So I wanted to make some screenshots for you and now it works… I don't get it haven't edit anything....
It would seem that Access World Forum is a very potent force.
Just reporting your programs errant behavior here has made it work ;) 😱:LOL:
 

Users who are viewing this thread

Top Bottom