Need help creating query to filter SQL 7 table by date field

  • Thread starter Thread starter Ivan Starr
  • Start date Start date
I

Ivan Starr

Hello thank you for helping,

I'm trying to create a where phrase to pass in an openform command that
will return all records that have a particular date in a date field DateSent
in a linked table (dbo_Transmittals). The form returns with no records when
I know records exist with the date I was filtering on.

I execute a command in code like the following
DoCmd.OpenForm "Transmittals", , , WhereClause, acFormReadOnly

WhereClause had the value "DateSent = 6/11/2004". I also tried with
singlequotes around the date but that did not work eother.

Anyone have any ideas about what might be holding me up?

Thanks for your help,

Ivan
 
What does 6/11/2004 mean to you: June 11th, or November 6th? What has the
DATEFORMAT been set to in SQL Server?

The date does need to be surrounded with single quotes.

And what's actually stored in DateSent: a date, or a timestamp (date and
time)?
 
I guess that you use Access *database*, not Access
project. In this case simply set the WhereClause to:

"[DateSent] = #06/11/2004#"

(if you meant 11 June 2004)

The problem with your WhereClause at present is
interpreted as 6 DIVIDED by 11 then DIVIDED by 2004 and
NOT as June 11 2004.

HTH
Van T. Dinh
MVP (Access)
 
Take Van's advice. I read linked table, but my mind was thinking
pass-through query.
 
Back
Top