Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Pull data with entered date

I'm doing a Databse pull to get some information. I have the query working
but I'd like to have the Date part of the query to be entered via a prompt or
enter dates into a field and press retrieve button. How do I setup the Query
Value to allow me to do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Pull data with entered date

http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

--
Regards,
Tom Ogilvy


"Mike Punko" wrote in message
...
I'm doing a Databse pull to get some information. I have the query working
but I'd like to have the Date part of the query to be entered via a prompt

or
enter dates into a field and press retrieve button. How do I setup the

Query
Value to allow me to do this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Pull data with entered date

Ok the code kind of worked. It does prompt me for the date but no matter
what I type I get the error "ORA-01861: literal does not match format string"
any ideas

My old code just to run the query was.

=#2005/10/25 7:00:00 AM# And <=#2005/10/26 8:00:00 AM#


But when I try to just type in 2005/10/25 7:00:00 for my Start date and visa
versa for the End date I get the above error.

"Tom Ogilvy" wrote:

http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

--
Regards,
Tom Ogilvy


"Mike Punko" wrote in message
...
I'm doing a Databse pull to get some information. I have the query working
but I'd like to have the Date part of the query to be entered via a prompt

or
enter dates into a field and press retrieve button. How do I setup the

Query
Value to allow me to do this?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Pull data with entered date

Try typing it in with the # signs.

Obviously the database server doesn't see what is delivered as a query as
having valid values. So I can't really address that for this approach. If
you want to do it in code, you could build the string to match what works.

--
Regards,
Tom Ogilvy


"Mike Punko" wrote in message
...
Ok the code kind of worked. It does prompt me for the date but no matter
what I type I get the error "ORA-01861: literal does not match format

string"
any ideas

My old code just to run the query was.

=#2005/10/25 7:00:00 AM# And <=#2005/10/26 8:00:00 AM#


But when I try to just type in 2005/10/25 7:00:00 for my Start date and

visa
versa for the End date I get the above error.

"Tom Ogilvy" wrote:


http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

--
Regards,
Tom Ogilvy


"Mike Punko" wrote in message
...
I'm doing a Databse pull to get some information. I have the query

working
but I'd like to have the Date part of the query to be entered via a

prompt
or
enter dates into a field and press retrieve button. How do I setup

the
Query
Value to allow me to do this?






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Pull data with entered date

OK well maybe this might help

This is what I type in for the Value in the query

=2005/10/25 7:00 And <=2005/10/26 8:00


And this is what it does automaticly once I press enter.

=#2005/10/25 7:00:00 AM# And <=#2005/10/26 8:00:00 AM#



"Tom Ogilvy" wrote:

Try typing it in with the # signs.

Obviously the database server doesn't see what is delivered as a query as
having valid values. So I can't really address that for this approach. If
you want to do it in code, you could build the string to match what works.

--
Regards,
Tom Ogilvy


"Mike Punko" wrote in message
...
Ok the code kind of worked. It does prompt me for the date but no matter
what I type I get the error "ORA-01861: literal does not match format

string"
any ideas

My old code just to run the query was.

=#2005/10/25 7:00:00 AM# And <=#2005/10/26 8:00:00 AM#


But when I try to just type in 2005/10/25 7:00:00 for my Start date and

visa
versa for the End date I get the above error.

"Tom Ogilvy" wrote:


http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

--
Regards,
Tom Ogilvy


"Mike Punko" wrote in message
...
I'm doing a Databse pull to get some information. I have the query

working
but I'd like to have the Date part of the query to be entered via a

prompt
or
enter dates into a field and press retrieve button. How do I setup

the
Query
Value to allow me to do this?








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pull data with entered date


Hi,

I was grappling with this problem for quite a while and have (finally)
come up with a solution so hopefully this will help you.

The problem (I believe) is that the database is Oracle, whose internal
date format is (usually) 'DD-MON-YY'. No matter how I tried to pass
the date through a parameter box in MS Query it failed with an Oracle
error code.
I have not found a way round this using MS Query but I have found a way
round it if you build the query in VBA.

I just started recording a macro and opened a query in MS Query and
then passed it back to Excel. When you examine the Macro code you can
see where you need to edit the SQL.

Add the parameter value as a "?" (as suggested in this thread I think).
Then when you try and run the Macro Excel will prompt you for the
value. It should work if you enter a valid Oracle format date, e.g.
01-OCT-05.
I've linked this to a cell where the format is "text" so that it
doesn't try and convert it to an Excel date.

HTH.


--
scos00
------------------------------------------------------------------------
scos00's Profile: http://www.excelforum.com/member.php...o&userid=28264
View this thread: http://www.excelforum.com/showthread...hreadid=479472

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
Trying to pull the data for current date - Query Viol-8-r New Users to Excel 1 September 11th 09 01:49 AM
Date extraction from data pull M Thran Excel Discussion (Misc queries) 1 August 13th 09 04:37 PM
Enter date on one worksheet, pull data from another Shoney Excel Discussion (Misc queries) 2 November 9th 07 03:51 AM
Enter date, then pull data from another sheet Shoney Excel Discussion (Misc queries) 2 November 9th 07 03:40 AM
Pull latest date data - ignore the rest dallin Excel Worksheet Functions 4 February 9th 06 06:41 PM


All times are GMT +1. The time now is 03:02 AM.

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"