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

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
 
D

Douglas J. Steele

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)?
 
V

Van T. Dinh

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)
 
D

Douglas J. Steele

Take Van's advice. I read linked table, but my mind was thinking
pass-through query.
 

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