[AccessD] ADO Problem

Beach Access Software bchacc at san.rr.com
Tue Nov 28 18:19:44 CST 2006


Single quotes did it!!! Thanks everybody for your assistance.

Best,

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Tuesday, November 28, 2006 1:43 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] ADO Problem

On 28 Nov 2006 at 10:15, Beach Access Software wrote:

> Dear List:
> 
> A colleague (who thinks I know ADO) writes in to ask why the following:
> 
>    Conn.Execute "INSERT INTO tWeeklyUpdateSent ( DateSent ) " & _
>                  "SELECT " & dtToday & ""
> 
> Inserts a record into tWeeklyUpdateSent so the conection is OK.  But but
the
> date is 1/1/1900 instead of today´s date.

You are building  a string which looks like:
INSERT INTO tWeeklyUpdateSent ( DateSent ) SELECT 11/28/2006

What you want is:
INSERT INTO tWeeklyUpdateSent ( DateSent ) SELECT '11/28/2006'

so you need to use
 ... "SELECT '" & dtToday & "'"
(note the two single quotes)

-- 
Stuart


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.14.19/555 - Release Date: 11/27/2006
6:09 PM
 




More information about the AccessD mailing list