Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Question on MS Query in Excel 2000

I have a spreadsheet that has an MS Query embedded in it.
The query pulls from a database and then returns the data
to the excel spreadsheet. I have a field that I'm
prompted for called Received Date. Right now, when I open
the spreadsheet I get a dialog prompting me for the date.
What I want to do is change this to automatically use the
current date.
I right click on the data in the spreadsheet and select
edit query. Here is where I need help. I can't seem to
pinpoint the syntax to use today's date. I've tried
=Today()
=Date()
=Now()

and so on. I've tried with and without the parenthesis. I
also get the error:

'Now' is not a recognized function name. Statement(s) can
not be prepared.

Same thing with Today and Date.

Here is the SQL statement that was created:

SELECT CallLog.CallID, Subset.LASTNAME, Subset.FIRSTNAME,
CallLog.CallType, CallLog.ShortDesc, CallLog.RecvdBy,
CallLog.RecvdDate, CallLog.RecvdTime, CallLog.ModBy,
CallLog.ModDate, CallLog.ModTime, CallLog.Tracker
FROM heatdb.dbo.CallLog CallLog, heatdb.dbo.Subset Subset
WHERE Subset.CallID = CallLog.CallID AND
((CallLog.Tracker='JonesB') AND (CallLog.RecvdDate=?))
ORDER BY CallLog.Tracker, CallLog.RecvdDate,
CallLog.ModDate


Can any one tell me how to do this?
Thanks
Bill

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Question on MS Query in Excel 2000

Hi Bill,

Is the data source SQL Server, Access, or something else? If SQL Server,
you should be able to use GetDate(). If Access, you can use Date(). You
should put one of these directly in the SQL statement in place of the "?".

--
Regards,

Jake Marx
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Bill wrote:
I have a spreadsheet that has an MS Query embedded in it.
The query pulls from a database and then returns the data
to the excel spreadsheet. I have a field that I'm
prompted for called Received Date. Right now, when I open
the spreadsheet I get a dialog prompting me for the date.
What I want to do is change this to automatically use the
current date.
I right click on the data in the spreadsheet and select
edit query. Here is where I need help. I can't seem to
pinpoint the syntax to use today's date. I've tried
=Today()
=Date()
=Now()

and so on. I've tried with and without the parenthesis. I
also get the error:

'Now' is not a recognized function name. Statement(s) can
not be prepared.

Same thing with Today and Date.

Here is the SQL statement that was created:

SELECT CallLog.CallID, Subset.LASTNAME, Subset.FIRSTNAME,
CallLog.CallType, CallLog.ShortDesc, CallLog.RecvdBy,
CallLog.RecvdDate, CallLog.RecvdTime, CallLog.ModBy,
CallLog.ModDate, CallLog.ModTime, CallLog.Tracker
FROM heatdb.dbo.CallLog CallLog, heatdb.dbo.Subset Subset
WHERE Subset.CallID = CallLog.CallID AND
((CallLog.Tracker='JonesB') AND (CallLog.RecvdDate=?))
ORDER BY CallLog.Tracker, CallLog.RecvdDate,
CallLog.ModDate


Can any one tell me how to do this?
Thanks
Bill


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Question on MS Query in Excel 2000

Sorry for the delay in responded, Jake. I was out of the
office. I think it is SQL and I put the GetDate() in the
query and and excepts it, but returns no information.
Here is the modified SQL statement:

((CallLog.Tracker='JonesB') AND (CallLog.RecvdDate=GetDate
())
-----Original Message-----
Hi Bill,

Is the data source SQL Server, Access, or something

else? If SQL Server,
you should be able to use GetDate(). If Access, you can

use Date(). You
should put one of these directly in the SQL statement in

place of the "?".

--
Regards,

Jake Marx
www.longhead.com

[please keep replies in the newsgroup - email address

unmonitored]


Bill wrote:
I have a spreadsheet that has an MS Query embedded in

it.
The query pulls from a database and then returns the

data
to the excel spreadsheet. I have a field that I'm
prompted for called Received Date. Right now, when I

open
the spreadsheet I get a dialog prompting me for the

date.
What I want to do is change this to automatically use

the
current date.
I right click on the data in the spreadsheet and select
edit query. Here is where I need help. I can't seem to
pinpoint the syntax to use today's date. I've tried
=Today()
=Date()
=Now()

and so on. I've tried with and without the

parenthesis. I
also get the error:

'Now' is not a recognized function name. Statement(s)

can
not be prepared.

Same thing with Today and Date.

Here is the SQL statement that was created:

SELECT CallLog.CallID, Subset.LASTNAME,

Subset.FIRSTNAME,
CallLog.CallType, CallLog.ShortDesc, CallLog.RecvdBy,
CallLog.RecvdDate, CallLog.RecvdTime, CallLog.ModBy,
CallLog.ModDate, CallLog.ModTime, CallLog.Tracker
FROM heatdb.dbo.CallLog CallLog, heatdb.dbo.Subset

Subset
WHERE Subset.CallID = CallLog.CallID AND
((CallLog.Tracker='JonesB') AND (CallLog.RecvdDate=?))
ORDER BY CallLog.Tracker, CallLog.RecvdDate,
CallLog.ModDate


Can any one tell me how to do this?
Thanks
Bill


.

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
Error using Data Query within Excel 2000 thunter Excel Discussion (Misc queries) 1 April 12th 10 08:21 PM
MS Query will not start from Excel 2000 Ian Excel Discussion (Misc queries) 8 May 21st 09 01:09 PM
Edit query in excel 2000 Joel Nieto Excel Discussion (Misc queries) 0 April 17th 06 09:31 PM
Excel 2000 hangs on new database query XP quasar Excel Discussion (Misc queries) 0 April 8th 06 07:31 PM
stock quote lookup query for Excel 2000 cyclist4444 Excel Worksheet Functions 0 February 4th 06 06:13 PM


All times are GMT +1. The time now is 09:41 AM.

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

About Us

"It's about Microsoft Excel"