View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Entering Date via SQL Query

Have you tried using a string in the SQL Insert statement?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ajitrajput " wrote in message
...
My underlying database is Excel and I am writing all DB related
operations using ADO in Visual Basic Editor of Excel (VBA). I am using
Excel Driver. The data is stored directly into Excel columns as
mentioned in the insert query.

But, when I enter the date value in a column, it attaches a
single-quote(') before the value. I have applied date-formatting to the
respective column as (mm/dd/yyyy), but still it doesn't work. I want to
programmatically enter the date value without any single-quote i.e the
value should be treated as date datatype.

Because of this single-quote(') to the date value which the date-value
in the cell to be considered as TEXT and hence whenever I want to fetch
records between date-range, the SELECT query does not pick-up proper
records.

[Since the end-user of my application will not open the files and make
manual changes, i want the proper date entry to be made without any
single quote...]

Sample Query:
INSERT INTO [mms_instrDR_dtl$](strInstrSeqNbr, dtDR,
dtCreated,strCreatedBy)
VALUES('CLDEL01040400002',#7/21/2004#,#7/21/2004#,'ajit')

Please help me !!! Trying from last 2 days..


---
Message posted from http://www.ExcelForum.com/