Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default MS Query 2000 on dates with parameters

I am trying to get a query with parameters on a date field to show up properly.

#3/01/2009# And <#3/31/2009#


This above statement works in the date field criteria.

#3/01/2009# And <[Please enter an ending date]


This above statement does not.

Ultimately I want to set it up to do this

=[Please enter a start date] And <=[Please enter an ending date]


Is there any better way to do this or to make the above work properly?

Database is MySQL if it matters.

Any help is appreciated. rasinc
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default MS Query 2000 on dates with parameters

Hi,

This works for me on the Criteria row in MS Query:

=[Start Date] And <=[End Date]

as does this
Between [Start Date] And [End Date]

Try looking at the SQL statement in MS Query - in my case it is

WHERE (Employees.HireDate Between ? And ?)



--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"rasinc" wrote:

I am trying to get a query with parameters on a date field to show up properly.

#3/01/2009# And <#3/31/2009#


This above statement works in the date field criteria.

#3/01/2009# And <[Please enter an ending date]


This above statement does not.

Ultimately I want to set it up to do this

=[Please enter a start date] And <=[Please enter an ending date]


Is there any better way to do this or to make the above work properly?

Database is MySQL if it matters.

Any help is appreciated. rasinc

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default MS Query 2000 on dates with parameters

I was trying that kind of thing but MySQL doesn't seem to like it. The SQL
statement does have the [Start Date] in the statement instead of ?. I am
sure this worked fine on an Access database I worked on before but it might
be the change in database that makes it not work now. I'll keep hunting.

Thanks for responding.

"Shane Devenshire" wrote:

Hi,

This works for me on the Criteria row in MS Query:

=[Start Date] And <=[End Date]

as does this
Between [Start Date] And [End Date]

Try looking at the SQL statement in MS Query - in my case it is

WHERE (Employees.HireDate Between ? And ?)



--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"rasinc" wrote:

I am trying to get a query with parameters on a date field to show up properly.

#3/01/2009# And <#3/31/2009#


This above statement works in the date field criteria.

#3/01/2009# And <[Please enter an ending date]


This above statement does not.

Ultimately I want to set it up to do this

=[Please enter a start date] And <=[Please enter an ending date]


Is there any better way to do this or to make the above work properly?

Database is MySQL if it matters.

Any help is appreciated. rasinc

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default MS Query 2000 on dates with parameters

Hi Shane,
After some playing around I was able to get rid of the syntax error message
by removing the field =sum(amount) but the query returned no data at all. So
there is something to do with the sum function involved here.

"Shane Devenshire" wrote:

Hi,

This works for me on the Criteria row in MS Query:

=[Start Date] And <=[End Date]

as does this
Between [Start Date] And [End Date]

Try looking at the SQL statement in MS Query - in my case it is

WHERE (Employees.HireDate Between ? And ?)



--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"rasinc" wrote:

I am trying to get a query with parameters on a date field to show up properly.

#3/01/2009# And <#3/31/2009#


This above statement works in the date field criteria.

#3/01/2009# And <[Please enter an ending date]


This above statement does not.

Ultimately I want to set it up to do this

=[Please enter a start date] And <=[Please enter an ending date]


Is there any better way to do this or to make the above work properly?

Database is MySQL if it matters.

Any help is appreciated. rasinc

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default MS Query 2000 on dates with parameters

Figured out the problem. Extra date field was causing the problem when using
a Sum formula. Then the date format in MySQL had to be yyyy/MM/dd. Then it
worked.

Thanks

"Shane Devenshire" wrote:

Hi,

This works for me on the Criteria row in MS Query:

=[Start Date] And <=[End Date]

as does this
Between [Start Date] And [End Date]

Try looking at the SQL statement in MS Query - in my case it is

WHERE (Employees.HireDate Between ? And ?)



--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"rasinc" wrote:

I am trying to get a query with parameters on a date field to show up properly.

#3/01/2009# And <#3/31/2009#


This above statement works in the date field criteria.

#3/01/2009# And <[Please enter an ending date]


This above statement does not.

Ultimately I want to set it up to do this

=[Please enter a start date] And <=[Please enter an ending date]


Is there any better way to do this or to make the above work properly?

Database is MySQL if it matters.

Any help is appreciated. rasinc

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Query Parameters jason Excel Discussion (Misc queries) 1 February 8th 09 10:02 PM
MS Query - 2 Parameters cottage6 Excel Discussion (Misc queries) 2 July 17th 08 09:16 PM
Multiple parameters in MS Query Ken Excel Discussion (Misc queries) 1 August 19th 06 01:48 PM
Query Parameters Texas_Toast Excel Discussion (Misc queries) 0 January 11th 06 03:14 PM
Help : Using Parameters with External Date Query Bdavis Excel Discussion (Misc queries) 0 March 31st 05 05:03 PM


All times are GMT +1. The time now is 03:53 PM.

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

About Us

"It's about Microsoft Excel"