Wrox Programmer Forums
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 11th, 2006, 01:43 AM
Authorized User
Join Date: Sep 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Format loss on import

Hey everyone, i'm having a weird problem when i import an excel
spreadsheet into a table. all data is imported fine except some of the feilds that are meant to be dates are converted to text... but some remain dates...???

Function funcImport(strTableName, strFileName As String)
On Error GoTo funcImport_Err

    ' Close Table
        DoCmd.Close acTable, strTableName
    ' Delete Table
        DoCmd.DeleteObject acTable, strTableName
    ' Import Spreadsheet into table
        DoCmd.TransferSpreadsheet acImport, 8, strTableName, strFileName, True, ""

    Exit Function

    MsgBox Error$
    Resume funcImport_Exit

End Function

any help would be appreciated... thankyou

Old September 11th, 2006, 07:34 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Is the field listed as a date field in the Excel spreadsheet?

Many time people take dumps from databases into Excel and Excel uses General on most of the fields, which are then forwarded to the new database which guesses formatting.

There is code to set the format of a particular field and there was a post on it in this forum. I would format the Excel spreadsheet before I imported it if it is not formatted as a date column already.


Similar Threads
Thread Thread Starter Forum Replies Last Post
possible loss of precision hobby Java Basics 7 September 19th, 2008 09:41 PM
VBA SQL import from Excel number format aem Excel VBA 0 January 19th, 2005 02:28 AM
I'm at a loss with IIS 5.1... wrofox Classic ASP Basics 0 September 19th, 2004 02:19 PM
Data loss during backup / restore 7.0 to 2000 mat41 SQL Server 2000 0 February 19th, 2004 05:50 PM
Import Date Format daver676 Access 5 June 28th, 2003 08:06 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.