Syntax error in date in query expression #My_date=01.07.2020.#

Anonymous
2020-07-01T17:21:08+00:00

Hello

I have vba code on the unbound combo box in access but when I load the form I get syntax error in date. My date format is dd.mm.yyyy.

Please see attached screenshot. Could someone help with this error. Thank you.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2020-07-02T20:23:29+00:00

    Please notice, that a combobox can only hold text items, thus the first column will be FD_Date (or Date()) casted to text as to your regional settings of Windows.

    Also, I guess you wish to order by the date value, not the day. Then you would need a column like

    Format(Date(), "yyyymmdd")

    to order by.

    0 comments No comments

15 additional answers

Sort by: Most helpful
  1. Anonymous
    2020-07-02T14:30:47+00:00

    It should read:

    If IsNull(DLookup("fd_date", "Food_Distribution", "fd_date = Date()")) Then

    0 comments No comments
  2. Anonymous
    2020-07-02T14:59:43+00:00

    Getting a message 

    Variable is not defined probably. Public function (ByVal fd_date as Date)

    0 comments No comments
  3. Anonymous
    2020-07-02T15:12:00+00:00

    fd_date appears to be a field name. 

    I'm not aware of the code line "Public Function (ByVal fd_date As Date)" which holds incorrect syntax (missing function name).

    0 comments No comments
  4. Anonymous
    2020-07-02T15:16:26+00:00

    FD_Date field is Date format (Short date). My  format is dd.mm.yyyy because I am in Europe.

    0 comments No comments