Results 1 to 3 of 3
  1. #1
    jj1 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    128

    Exporting Data from Ms Access form to Excel sheet

    I am trying to export date field from MS ACCESS form to Excel Sheet through following VBA code but it prints as a number such as 41795 instead of actual date on access form.

    Dim objexcel As Excel.Application
    Dim objworkbook As Excel.Workbook
    Dim objxlsheet As Worksheet
    Set objexcel = CreateObject("Excel.Application")
    ''Set objworkbook = objexcel.Workbooks.Open("C:\MSEXCEL_TEST" & "\" & "test.xlsx")
    Set objworkbook = objexcel.Workbooks.Open(CurrentProject.Path & "\" & "HERCA_TWTTP_FORM.xlsx")
    Set objxlsheet = objworkbook.ActiveSheet







    objxlsheet.Cells(11, 4) = Me.dateIdentified
    objxlsheet.Cells(4, 1) = Me.txtProblem
    objxlsheet.Cells(4, 10) = Me.txtOperation
    objxlsheet.Cells(11, 13) = Me.txtOperatorName
    objxlsheet.Cells(11, 30) = Me.txtInterviewerName


    objxlsheet.Cells(13, 13) = Me.dateCompleted
    objxlsheet.Cells(12, 13) = Me.txtTeam
    objexcel.Visible = True
    Set objexcel = Nothing
    End Sub


    HOW CAN I CHANGE IT TO ACTUAL DATE.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Dates are just numbers, so format it the way you want...format(Me.dateCompleted,"mm/dd/yyyy")

  3. #3
    jj1 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    128
    Awesom that helped ......

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 05-09-2014, 11:27 AM
  2. Exporting into Excel, Automating a Summary Sheet
    By sam.eade in forum Import/Export Data
    Replies: 3
    Last Post: 09-26-2013, 02:14 AM
  3. Import excel sheet data into Ms-access using VBA macros
    By gokul1242 in forum Import/Export Data
    Replies: 2
    Last Post: 10-02-2012, 04:39 AM
  4. exporting data from access to excel
    By tariq nawaz in forum Access
    Replies: 3
    Last Post: 09-06-2012, 09:29 AM
  5. Exporting to Specific Excel Sheet
    By unrealtb in forum Access
    Replies: 2
    Last Post: 01-24-2012, 10:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums