Join Dates from 2 tables with different formats in a query

Q

Qaspec

Table A was created with Dates and Time in each record and even when I change
the table format to Short Date to match table B (which has date but no time
data) the query will still not reurn any values because the date values are
not being considred even. How can I get the Date\Time in table a to be Date
only?
 
V

vanderghast

You apply DateValue to the dateTime field:

....
FROM table1 INNER JOIN table2
ON table1.DateOnlyField = DateValue(table2.DateAndTimeValue)
.....



Applying a format is only a cosmetic, a makeup. The real thing is left
unchanged by a format unless you capture the result of the format itself,
which is then a string, so you would have to convert it back to a date:

CDate(Format(now, "mm/dd/yyyy"))


but that is much more expensive than using DateValue.



Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top