Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default Date problem

Hi,

i'm trying to insert a new record in Access 2000 via Excel 2000.


In Excel the date is formatted as "dd/mm/yy" (I'm in Australia).
In Access the table has no format but all of the dates appear as 14/10/2008.

As I step through my code

Sub AddARow()
Dim DB As DAO.DataBase
Set DB = DBEngine.OpenDatabase("G:\00_CEN\Oth\Inventory Planning
Reports\POL\POL.MDB")

Application.Goto reference:="RC2"
The_CURR_DATE = ActiveCell.Value
The_sSQL = "INSERT INTO tbl_Plan_Data (CURR_DATE) VALUES (The_CURR_DATE);
DB.Execute The_sSQL
DB.Close
Set DB = Nothing
End Sub

it inserts a record but is shown as 12:00:31 AM.

How do I get it to show as 14/10/2008??

--
Andrew
151008
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Date problem

Dates for Access must be formatted in the American format, rather than in the
format that you and I (from the UK) would both prefer them to be in. Try:-

The_sSQL = "INSERT INTO tbl_Plan_Data (CURR_DATE) VALUES (#" &
format(The_CURR_DATE,"m/d/yy" & "#);

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk


"Andrew" wrote:

Hi,

i'm trying to insert a new record in Access 2000 via Excel 2000.


In Excel the date is formatted as "dd/mm/yy" (I'm in Australia).
In Access the table has no format but all of the dates appear as 14/10/2008.

As I step through my code

Sub AddARow()
Dim DB As DAO.DataBase
Set DB = DBEngine.OpenDatabase("G:\00_CEN\Oth\Inventory Planning
Reports\POL\POL.MDB")

Application.Goto reference:="RC2"
The_CURR_DATE = ActiveCell.Value
The_sSQL = "INSERT INTO tbl_Plan_Data (CURR_DATE) VALUES (The_CURR_DATE);
DB.Execute The_sSQL
DB.Close
Set DB = Nothing
End Sub

it inserts a record but is shown as 12:00:31 AM.

How do I get it to show as 14/10/2008??

--
Andrew
151008

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Date problem

Sorry, missed a quote off. I'm sure that you would have realised, but for
correctness:-

The_sSQL = "INSERT INTO tbl_Plan_Data (CURR_DATE) VALUES (#" &
Format(The_CURR_DATE,"m/d/yy" & "#);"

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk


"Alan Moseley" wrote:

Dates for Access must be formatted in the American format, rather than in the
format that you and I (from the UK) would both prefer them to be in. Try:-

The_sSQL = "INSERT INTO tbl_Plan_Data (CURR_DATE) VALUES (#" &
format(The_CURR_DATE,"m/d/yy" & "#);

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk


"Andrew" wrote:

Hi,

i'm trying to insert a new record in Access 2000 via Excel 2000.


In Excel the date is formatted as "dd/mm/yy" (I'm in Australia).
In Access the table has no format but all of the dates appear as 14/10/2008.

As I step through my code

Sub AddARow()
Dim DB As DAO.DataBase
Set DB = DBEngine.OpenDatabase("G:\00_CEN\Oth\Inventory Planning
Reports\POL\POL.MDB")

Application.Goto reference:="RC2"
The_CURR_DATE = ActiveCell.Value
The_sSQL = "INSERT INTO tbl_Plan_Data (CURR_DATE) VALUES (The_CURR_DATE);
DB.Execute The_sSQL
DB.Close
Set DB = Nothing
End Sub

it inserts a record but is shown as 12:00:31 AM.

How do I get it to show as 14/10/2008??

--
Andrew
151008

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
Exel increment date problem wrt todays date. [email protected] Excel Worksheet Functions 1 November 11th 07 06:58 PM
Date Formula Problem - Leave date blank if Null Gayla Excel Worksheet Functions 5 April 24th 07 09:42 PM
Us date versus EU date problem Jan T. Excel Programming 7 October 2nd 06 07:06 PM
Need help with date problem. Wiley in Norcal Excel Programming 2 July 26th 05 08:23 PM
Date Problem Dutyman Excel Discussion (Misc queries) 3 May 25th 05 01:01 PM


All times are GMT +1. The time now is 03:20 PM.

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"