Neuigkeiten:

Ist euer Problem gelöst, dann bitte den Knopf "Thema gelöst" drücken!

Mobiles Hauptmenü

Laufzeitfehler - Syntaxis in Datum in Abfrageausdruck

Begonnen von soylatino, Oktober 04, 2018, 02:23:16

⏪ vorheriges - nächstes ⏩

soylatino

Hallo liebes Forum,

ich hoffe ihr könnt mir dabei helfen. Ich versuche herauszufinden, warum erscheint immer eine Fehlermeldung wenn ich mein Formular starte:

Die Fehlermeldung lautet:
Microsoft VIsual Basic
Laufzeitfehler "3075"

Syntaxfehler in Datum in Abfrageausdruck "[Attdate] = #04.10.2018"

Der Code:
Private Sub Form_Load()
Dim AddToday As String
DoCmd.ShowToolbar "Ribbon", acToolbarNo
Me.cmdOldClass.Caption = "Old Classes"
Me.ListClass.RowSource = "select * from qryClasslist where currentActive = true"

If IsNull(DLookup("Date_ID", "tblAttDate", "[Attdate] = #" & Date & "#")) Then

        'MsgBox "is null"
        'add today date to AttDate table
        AddToday = "Insert INTO tblAttDate(AttDate) Select Date() as myTodayDate;"
                'MsgBox (AddToday)
                DoCmd.SetWarnings False
                DoCmd.RunSQL AddToday
                DoCmd.SetWarnings True
Else
    'MsgBox "is not null" ' Do nothing
End If
End Sub



Danke im voraus!

DF6GL

Hallo,


SQL erfordert ISO- oder US-Datumsformat

If IsNull(DLookup("Date_ID", "tblAttDate", "[Attdate] = " & Format(Date,"\#yyyy-mm-dd\#") ) )Then

oder gleich die Date-Funktion als Teil der Where-Condition einsetzen:
If IsNull(DLookup("Date_ID", "tblAttDate", "[Attdate] = Date()")) Then
Viele Grüße vom Bodensee
Franz, DF6GL

Hilfestellung:  http://www.access-o-mania.de/forum/index.php?topic=6969.msg118738#msg118738

Links und Tipps:
1.   http://v.hdm-stuttgart.de/~riekert/lehre/db-kelz/
1a. http://www.tinohempel.de/info/info/datenbank/normalisierung.htm
1b. https://support.office.com/de-de/article/Grundlagen-des-Datenbankentwurfs-eb2159cf-1e30-401a-8084-bd4f9c9ca1f5#bmterms
2.   http://www.donkarl.com
3.   https://web.archive.org/web/20201201233522/http://www.dbwiki.net/
4.   http://www.access-tutorial.de/
5.   http://www.tty1.net/smart-questions_de.htm
6.   http://access.joposol.com/accept

Last but not least:   < F1 > für Hilfe
;) Learning by doing not by spoon-feed ;)

Tipp: Find and Replace for Access