A
A
Alexander Shilov2019-06-05 10:03:44
Microsoft Access
Alexander Shilov, 2019-06-05 10:03:44

How to query by date in Access database?

There are two fields " Field47 " and "Field49" in which the date is entered. You need to select from the table " Technical documentation " all records in the range of these dates. Here is the request:

StrSql = "SELECT * FROM [Техническая документация] WHERE [Техническая документация].Дата_разноса >= #" & Me.Поле47.Value & "# and [Техническая документация].Дата_разноса <= #" & Me.Поле49.Value & "#;"
    Set qdf = db.CreateQueryDef("gen_a_report", StrSql)
    DoCmd.OpenQuery "gen_a_report", acViewNormal

But it throws an error
Mistake
5cf76924ea3a2550999770.jpeg

There is data on the input range.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BasiC2k, 2019-06-05
@tabbols95

Check the date format, should be: yyyy-mm-dd

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question