A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

dates in query HELP PLEASE!



 
 
Thread Tools Display Modes
  #1  
Old May 31st, 2004, 11:48 PM
Jorge Novoa
external usenet poster
 
Posts: n/a
Default dates in query HELP PLEASE!

Hello everyone.
I have a little question:

I got some controls in a form, I'm trying to run a query with the values of
these control, of course. Both are date values,
I create a where string clause, which goes like this:
strWhereSql= "WHERE Retts.Date between #" & me.datStart & " AND " &
me.datEnd

Then I append the where string to the rest of the SQL string, in order to
run it later. No problem or doubt with that.

I'm using Access XP in Spanish, windows 98 in Spanish, the system settings
for date is: DD/MM/YYYY

The string created is like this:
WHERE Retts.Date between #11/05/2004# AND #11/05/2004#

You see? It has to be May 11, 2004 for me
BUT Access returns me the data for November 5, 2004 !!!!!!!
It turns the days to month, and the mont to days
WHY???

Another thing: if I try with 20/05/2004, that is May 20, 2004 for me, for
example, it returns the data for May 20, 2004.!!!!¿?¿?¿?!!!! ¿?¿¿?!!!!
WHY???

Why does Access 'convert' the date as it please???

All my formats, all my settings are dd/mm/yyyy, but access keep using the
mm/dd/yyyy format when running a query.

I've also tried: format(datStart, "dd/mmm/yyyy"), but it' doesn't work

I'm amazed how access change these values, I know it has something to be
with the language, I Only need to know why is this situation caused, and how
to correct it.

PLEASE HEEEELP


Thanx!


--
________________
Jorge Novoa
F.A. Arias & Muñoz
El Salvador, C.A.




  #2  
Old June 1st, 2004, 02:15 AM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default dates in query HELP PLEASE!

Regardless of what your regional settings have the short date format set to,
you must use mm/dd/yyyy in your queries. Access will always translate your
date to mm/dd/yyyy format if that makes sense. Since there is no 20th month,
it treats 20/05/2004 as 20 May, but since there is a 10th month, it will
treat 10/05/2004 as 05 October, not as 10 May.

Try:

strWhereSql= "WHERE Retts.Date between " & _
Format$(me.datStart, "\#mm\/dd\/yyyy\#") & _
" AND " & Format$(me.datEnd, "\#mm\/dd\/yyyy\#")

You may find Allen Browne's "International Dates in Access" at
http://members.iinet.net.au/~allenbrowne/ser-36.html to be informative, or
check out what I have at
http://members.rogers.com/douglas.j....artAccess.html


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jorge Novoa" wrote in message
...
Hello everyone.
I have a little question:

I got some controls in a form, I'm trying to run a query with the values

of
these control, of course. Both are date values,
I create a where string clause, which goes like this:
strWhereSql= "WHERE Retts.Date between #" & me.datStart & " AND " &
me.datEnd

Then I append the where string to the rest of the SQL string, in order to
run it later. No problem or doubt with that.

I'm using Access XP in Spanish, windows 98 in Spanish, the system settings
for date is: DD/MM/YYYY

The string created is like this:
WHERE Retts.Date between #11/05/2004# AND #11/05/2004#

You see? It has to be May 11, 2004 for me
BUT Access returns me the data for November 5, 2004 !!!!!!!
It turns the days to month, and the mont to days
WHY???

Another thing: if I try with 20/05/2004, that is May 20, 2004 for me, for
example, it returns the data for May 20, 2004.!!!!¿?¿?¿?!!!! ¿?¿¿?!!!!
WHY???

Why does Access 'convert' the date as it please???

All my formats, all my settings are dd/mm/yyyy, but access keep using the
mm/dd/yyyy format when running a query.

I've also tried: format(datStart, "dd/mmm/yyyy"), but it' doesn't work

I'm amazed how access change these values, I know it has something to be
with the language, I Only need to know why is this situation caused, and

how
to correct it.

PLEASE HEEEELP


Thanx!


--
________________
Jorge Novoa
F.A. Arias & Muñoz
El Salvador, C.A.






  #3  
Old June 2nd, 2004, 01:07 AM
ChrisJ
external usenet poster
 
Posts: n/a
Default dates in query HELP PLEASE!

Another idea is to format the date as

"dd mmm yyyy" or "mmm dd yyyy" which gives
05 Nov 2004 or May 11 2004

This way access gets an unambiguous date and cannot get it=20
wrong.


-----Original Message-----
Hello everyone.
I have a little question:

I got some controls in a form, I'm trying to run a query=20

with the values of
these control, of course. Both are date values,
I create a where string clause, which goes like this:
strWhereSql=3D "WHERE Retts.Date between #" &=20

me.datStart & " AND " &
me.datEnd

Then I append the where string to the rest of the SQL=20

string, in order to
run it later. No problem or doubt with that.

I'm using Access XP in Spanish, windows 98 in Spanish,=20

the system settings
for date is: DD/MM/YYYY

The string created is like this:
WHERE Retts.Date between #11/05/2004# AND #11/05/2004#

You see? It has to be May 11, 2004 for me
BUT Access returns me the data for November 5,=20

2004 !!!!!!!
It turns the days to month, and the mont to days
WHY???

Another thing: if I try with 20/05/2004, that is May 20,=20

2004 for me, for
example, it returns the data for May 20, 2004.!!!!=BF?=BF?

=BF?!!!! =BF?=BF=BF?!!!!
WHY???

Why does Access 'convert' the date as it please???

All my formats, all my settings are dd/mm/yyyy, but=20

access keep using the
mm/dd/yyyy format when running a query.

I've also tried: format(datStart, "dd/mmm/yyyy"), but it'=20

doesn't work

I'm amazed how access change these values, I know it has=20

something to be
with the language, I Only need to know why is this=20

situation caused, and how
to correct it.

PLEASE HEEEELP


Thanx!


--
________________
Jorge Novoa
F.A. Arias & Mu=F1oz
El Salvador, C.A.




.

  #4  
Old June 2nd, 2004, 05:34 PM
Jorge Novoa
external usenet poster
 
Posts: n/a
Default dates in query HELP PLEASE!

Thanx a lot!

--
________________
Jorge Novoa
F.A. Arias & Muñoz
El Salvador, C.A.

"Douglas J. Steele" escribió en el
mensaje ...
Regardless of what your regional settings have the short date format set

to,
you must use mm/dd/yyyy in your queries. Access will always translate your
date to mm/dd/yyyy format if that makes sense. Since there is no 20th

month,
it treats 20/05/2004 as 20 May, but since there is a 10th month, it will
treat 10/05/2004 as 05 October, not as 10 May.

Try:

strWhereSql= "WHERE Retts.Date between " & _
Format$(me.datStart, "\#mm\/dd\/yyyy\#") & _
" AND " & Format$(me.datEnd, "\#mm\/dd\/yyyy\#")

You may find Allen Browne's "International Dates in Access" at
http://members.iinet.net.au/~allenbrowne/ser-36.html to be informative, or
check out what I have at
http://members.rogers.com/douglas.j....artAccess.html


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jorge Novoa" wrote in message
...
Hello everyone.
I have a little question:

I got some controls in a form, I'm trying to run a query with the values

of
these control, of course. Both are date values,
I create a where string clause, which goes like this:
strWhereSql= "WHERE Retts.Date between #" & me.datStart & " AND " &
me.datEnd

Then I append the where string to the rest of the SQL string, in order

to
run it later. No problem or doubt with that.

I'm using Access XP in Spanish, windows 98 in Spanish, the system

settings
for date is: DD/MM/YYYY

The string created is like this:
WHERE Retts.Date between #11/05/2004# AND #11/05/2004#

You see? It has to be May 11, 2004 for me
BUT Access returns me the data for November 5, 2004 !!!!!!!
It turns the days to month, and the mont to days
WHY???

Another thing: if I try with 20/05/2004, that is May 20, 2004 for me,

for
example, it returns the data for May 20, 2004.!!!!¿?¿?¿?!!!! ¿?¿¿?!!!!
WHY???

Why does Access 'convert' the date as it please???

All my formats, all my settings are dd/mm/yyyy, but access keep using

the
mm/dd/yyyy format when running a query.

I've also tried: format(datStart, "dd/mmm/yyyy"), but it' doesn't work

I'm amazed how access change these values, I know it has something to be
with the language, I Only need to know why is this situation caused, and

how
to correct it.

PLEASE HEEEELP


Thanx!


--
________________
Jorge Novoa
F.A. Arias & Muñoz
El Salvador, C.A.








 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.