[AccessD] ADO Problem

A.D.TEJPAL adtp at airtelbroadband.in
Tue Nov 28 23:29:04 CST 2006


Rocky,

    You might recall the thread "Date Comparison Problem" initiated by you in march-2006. It elicited the overall consensus that in order to avoid any possible pitfalls on account of various regional settings (that might differ from US date format), any date variable to be concatenated into a VBA string should first be preformatted to "mm/dd/yyyy" format.

    Accordingly, the following syntax should ideally be adopted:

    "INSERT INTO tWeeklyUpdateSent " & _
    "(DateSent) VALUES (#" & _
    Format(dtToday, "mm/dd/yyyy") & "#);"

Best wishes,
A.D.Tejpal
---------------

  ----- Original Message ----- 
  From: Beach Access Software 
  To: 'Access Developers discussion and problem solving' 
  Sent: Tuesday, November 28, 2006 23:45
  Subject: [AccessD] ADO Problem


  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.

  I had him check the contents of dtToday and it does indeed have 11/28/2006 in it.

  Does anyone see what he's doing wrong here?

  MTIA

  Rocky


More information about the AccessD mailing list