Date Issue

  • Thread starter Thread starter Qaspec
  • Start date Start date
Q

Qaspec

I have a table that is linked to another database. The
date information in the date column is in General Date
Format with specific times included. I want my query to
return results based on a query depending on the name or
number of the month selected from a control on a form. How
can I do this?

The form is "mainform"
the control is "selmonth"
and the qry is "qryinfo"

any help would be appreciated.
 
Keep in mind that the Format of the field has nothing to do with working
with the actual underlying data. A Date/Time data type uses the integer
part to count days since December 30, 1899, and the fractional part is the
time in fractions of a day - accurate to seconds.

Assuming "selmonth" is a number 1-12, you could do:

SELECT *
FROM MyTable
WHERE Month([DateField]) = [Forms]![mainform]![selmonth]

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
Back
Top