+ Reply to Thread
Results 1 to 10 of 10

Trouble exporting time from Excel to MS Access

  1. #1
    Registered User
    Join Date
    05-07-2015
    Location
    Angouleme, France
    MS-Off Ver
    2013
    Posts
    48

    Trouble exporting time from Excel to MS Access

    Hello !

    I am currently trying to export data from an Excel worksheet to an Access table, and the only problem I can't solve is the following one :
    While exporting data (Date, Numbers, text) is working well, it doesn't seem to work for the time. In my cell I have the function NOW, and the cell is formated to display hh:mm (24h format, btw). When I send it to Access, if the type is Date/Time (full time), the cell is blank. If the format is date it does display the date, though, and the same if it's text. When displaying it as a number, it shows an INTEGER.

    Am I doing something wrong with the format type (either Excel or Access) or is it necessarily from my VBA code ?

    My VBA macro in Excel contains the following :
    Please Login or Register  to view this content.
    Thank you all,

    François
    Last edited by AstroZelda; 05-18-2015 at 10:29 AM.

  2. #2
    Registered User
    Join Date
    05-07-2015
    Location
    Angouleme, France
    MS-Off Ver
    2013
    Posts
    48

    Re: Trouble exporting time from Excel to MS Access

    Edit : Put code into first message
    Last edited by AstroZelda; 05-18-2015 at 10:31 AM.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Trouble exporting time from Excel to MS Access

    You should use a Date/Time field in Access and format it to display time.

    If you did use a Number field you would have to change from Integer to Decimal/Double, with Integer you lose the time part and are left with only the date part.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    05-07-2015
    Location
    Angouleme, France
    MS-Off Ver
    2013
    Posts
    48

    Re: Trouble exporting time from Excel to MS Access

    Quote Originally Posted by Norie View Post
    If you did use a Number field you would have to change from Integer to Decimal/Double, with Integer you lose the time part and are left with only the date part.

    When I add digits to my value I have 42143.0000...

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Trouble exporting time from Excel to MS Access

    In Access you enclose date/time values in # not ', try changing the INSERT statement to reflect that.

  6. #6
    Registered User
    Join Date
    05-07-2015
    Location
    Angouleme, France
    MS-Off Ver
    2013
    Posts
    48

    Unhappy Re: Trouble exporting time from Excel to MS Access

    The problem is, when I try to remove the couple of ', or replace it by some #s, my macro doesn't work anymore...

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Trouble exporting time from Excel to MS Access

    What exactly did you try and how did it stop the code working?

  8. #8
    Registered User
    Join Date
    05-07-2015
    Location
    Angouleme, France
    MS-Off Ver
    2013
    Posts
    48

    Re: Trouble exporting time from Excel to MS Access

    I tried this
    Please Login or Register  to view this content.
    Isn't that what you implied ?

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Trouble exporting time from Excel to MS Access

    What exactly do you have in the cells?

    Can you upload a sample workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  10. #10
    Registered User
    Join Date
    05-07-2015
    Location
    Angouleme, France
    MS-Off Ver
    2013
    Posts
    48

    Re: Trouble exporting time from Excel to MS Access

    Here it is, I did it real quick, but I think it represents how my file duet works.

    TimeIssueDB.zip

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Exporting from Excel to Access
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-06-2008, 02:44 PM
  2. Access to Excel Exporting
    By cob943 in forum Excel General
    Replies: 3
    Last Post: 01-02-2008, 05:51 AM
  3. exporting access to excel
    By markmerid in forum Excel General
    Replies: 1
    Last Post: 10-09-2006, 09:28 AM
  4. Exporting from access into excel
    By Chris in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-21-2006, 04:05 AM
  5. Exporting to excel from Access
    By Stuart Y. in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2005, 06:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1