Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default how to format a date to be used in sqlstring in excel 2007?

I have a startdate in cell a1 as 12/1/2006 and enddate in cell a2 as
12/31/2006. These are used as parameters for a sqlstring in excel 2007.
sqlstring = sqlstring & '12/1/2006' ,'12/31/2006'

Excel gives me a run-time error '1004' : SQL syntax error.

Can someone please tell me how to format the dates??

Thanks,

Ragup
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default how to format a date to be used in sqlstring in excel 2007?

Seems to me that whenever I have to deal with dates I have to use # before
and after the date. This may not be the case for you at all, but I'd try:
sqlstring = sqlstring & #12/1/2006# ,#12/31/2006#

"ragup001" wrote:

I have a startdate in cell a1 as 12/1/2006 and enddate in cell a2 as
12/31/2006. These are used as parameters for a sqlstring in excel 2007.
sqlstring = sqlstring & '12/1/2006' ,'12/31/2006'

Excel gives me a run-time error '1004' : SQL syntax error.

Can someone please tell me how to format the dates??

Thanks,

Ragup

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 2007 format cells to date format Stefan Excel Discussion (Misc queries) 0 June 1st 10 09:06 PM
Date format in Excel 2007 mm/dd/yy not appearing correctly RickGCR Excel Worksheet Functions 2 January 6th 09 01:07 AM
Date format with Excel 2007 Israel Excel Discussion (Misc queries) 3 October 28th 08 05:12 PM
Date format on axis in Excel 2007 JAJ0111 Charts and Charting in Excel 0 January 30th 08 03:39 PM
Excel 2007 Date Format Problem terry Excel Discussion (Misc queries) 0 November 25th 06 06:16 AM


All times are GMT +1. The time now is 11:40 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"