Question: I have dates in `TakeDate` Field (Data type : Date ) in a table of MS Access.
I have a text Box `txtGdateTo` in a search form with `Format` set to `Short Date`

> 
> When I run SQL queries like as below, I don't get desired data filtered.
> 
> 
> 

```
Select * from tblWork WHERE TakeDate <= Me.txtGdateTo

```

Hence I tried the below SQL, but it does not work too.

```
Select * from tblWork WHERE TakeDate <= Format(Me.txtGdateTo, "\#mm\/dd\/yyyy\#")

```

I added another filed to the table `TakeDate0` with function

`TakeDate0: FormatDateTime([TakeDate],"\#mm/dd/yyyy\#")`

This gives me value as `#error`.

> 
> Q : Is there any best way to manage these errors using date field?
> 
> 
> Q : What formatting needs to be done and is there a need for the additional column?
> 
> 
> 

In my case, the users will enter data in the table in the format dd/mm/yyyy

Answer: 
*Me* can't be used in a query. So try:

```
Select * From tblWork Where TakeDate <= Format(Forms!YourForm!txtGdateTo, "\#mm\/dd\/yyyy\#")

```

In VBA you must format the *string expression* of the date before concatenating, like:

```
SQL = "Select * From tblWork Where TakeDate <= #" & Format(Me!txtGdateTo.Value, "yyyy\/mm\/dd") & "#"

```
After researching for about 2 hours and some hints from @Gustav answers, I was able to figure out the solution to the problem.

> 
> 1st - Use function `FormatDateTime` and not `Format`
> 
> 
> 

```
Select * from tblWork WHERE TakeDate <= #" & FormatDateTime(Me.txtTdateTo, 2) & "#"

```

> 
> 2nd - Make sure the format is correct
> 
> 
> 

`txtGdateTo` in a search form, `Format` set to `Short Date`

> 
> 3rd - No need for another column for searching functionality.
> 
> 
>