PC Review


Reply
Thread Tools Rate Thread

Date issue in Access 2007 SQL

 
 
MTate
Guest
Posts: n/a
 
      24th Feb 2010
I am investigating an SQL issue that exists in Access 2007 that doesn't exist
in Access 2003. I did not write the SQL code. I am assisting in resolving
the issue. Both versions of Access are running on a Citrix server.

Here is the problem:

In Access 2007 SQL, the following statement:
AND NESWHSLDT BETWEEN '02/14/2010' AND '02/20/2010' will convert to the
following when the date is changed to another date. For example when the 14
in 02/14/2010 is changed to 15, this is what the SQL changes to:
AND NESWHSLDT BETWEEN '02/015/2010' AND '02/20/2010'. An extra zero is
inserted into the SQL.

This does not occur with the same SQL running in Access 2003. We have
verified that all date formats are the same. Any help would be appreciated.
--
Thanks
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      24th Feb 2010
Use # as the delimiter around the literal date values in your SQL statement,
not the single-quote character.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"MTate" <(E-Mail Removed)> wrote in message
news:4CAB79DB-C0EA-44FA-BAAA-(E-Mail Removed)...
> I am investigating an SQL issue that exists in Access 2007 that doesn't
> exist
> in Access 2003. I did not write the SQL code. I am assisting in
> resolving
> the issue. Both versions of Access are running on a Citrix server.
>
> Here is the problem:
>
> In Access 2007 SQL, the following statement:
> AND NESWHSLDT BETWEEN '02/14/2010' AND '02/20/2010' will convert to the
> following when the date is changed to another date. For example when the
> 14
> in 02/14/2010 is changed to 15, this is what the SQL changes to:
> AND NESWHSLDT BETWEEN '02/015/2010' AND '02/20/2010'. An extra zero is
> inserted into the SQL.
>
> This does not occur with the same SQL running in Access 2003. We have
> verified that all date formats are the same. Any help would be
> appreciated.
> --
> Thanks


 
Reply With Quote
 
MTate
Guest
Posts: n/a
 
      24th Feb 2010
Thank You
--
Thanks


"Allen Browne" wrote:

> Use # as the delimiter around the literal date values in your SQL statement,
> not the single-quote character.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
>
> "MTate" <(E-Mail Removed)> wrote in message
> news:4CAB79DB-C0EA-44FA-BAAA-(E-Mail Removed)...
> > I am investigating an SQL issue that exists in Access 2007 that doesn't
> > exist
> > in Access 2003. I did not write the SQL code. I am assisting in
> > resolving
> > the issue. Both versions of Access are running on a Citrix server.
> >
> > Here is the problem:
> >
> > In Access 2007 SQL, the following statement:
> > AND NESWHSLDT BETWEEN '02/14/2010' AND '02/20/2010' will convert to the
> > following when the date is changed to another date. For example when the
> > 14
> > in 02/14/2010 is changed to 15, this is what the SQL changes to:
> > AND NESWHSLDT BETWEEN '02/015/2010' AND '02/20/2010'. An extra zero is
> > inserted into the SQL.
> >
> > This does not occur with the same SQL running in Access 2003. We have
> > verified that all date formats are the same. Any help would be
> > appreciated.
> > --
> > Thanks

>
> .
>

 
Reply With Quote
 
MTate
Guest
Posts: n/a
 
      24th Feb 2010
This was tested today and it did not work. For some reason in the SQL
(Access 2007) once the statement is saved it inserts a ' in the SQL. So now
it reads BETWEEN ' #02/14/2010# and #02/14/2010#

Any ideas? This does not occur in Access 2003.
--
Thanks


"Allen Browne" wrote:

> Use # as the delimiter around the literal date values in your SQL statement,
> not the single-quote character.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
>
> "MTate" <(E-Mail Removed)> wrote in message
> news:4CAB79DB-C0EA-44FA-BAAA-(E-Mail Removed)...
> > I am investigating an SQL issue that exists in Access 2007 that doesn't
> > exist
> > in Access 2003. I did not write the SQL code. I am assisting in
> > resolving
> > the issue. Both versions of Access are running on a Citrix server.
> >
> > Here is the problem:
> >
> > In Access 2007 SQL, the following statement:
> > AND NESWHSLDT BETWEEN '02/14/2010' AND '02/20/2010' will convert to the
> > following when the date is changed to another date. For example when the
> > 14
> > in 02/14/2010 is changed to 15, this is what the SQL changes to:
> > AND NESWHSLDT BETWEEN '02/015/2010' AND '02/20/2010'. An extra zero is
> > inserted into the SQL.
> >
> > This does not occur with the same SQL running in Access 2003. We have
> > verified that all date formats are the same. Any help would be
> > appreciated.
> > --
> > Thanks

>
> .
>

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      24th Feb 2010
On Wed, 24 Feb 2010 11:43:01 -0800, MTate <(E-Mail Removed)>
wrote:

>This was tested today and it did not work. For some reason in the SQL
>(Access 2007) once the statement is saved it inserts a ' in the SQL. So now
>it reads BETWEEN ' #02/14/2010# and #02/14/2010#
>
>Any ideas? This does not occur in Access 2003.


Have you perchance defined this query as a PassThrough Query (to SQL/Server,
which does use ' as a date delimiter)?
--

John W. Vinson [MVP]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2007 Date field shows Now instead of Date bobdydd Microsoft Access 4 19th Jul 2011 03:47 PM
Why Access 2007 donot have the "Data Access Page" Function ? How I can do with 2007 for this issue ? Martin Microsoft Access 4 3rd May 2010 08:46 PM
Ms Access 2007 and Ms Sharepoint 2007 (Issue with Attachments) scott Microsoft Access VBA Modules 2 8th Apr 2010 09:23 PM
Can Access 2007 automatically clear date field after date hasexpired? stevmich Microsoft Access Macros 2 23rd Jan 2010 05:56 PM
Access 2007: Query; Date Filters; After. Error: Includes date ty Stephen Microsoft Access 0 9th Jul 2009 04:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:20 PM.