Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21096

date dosnt show correctly after converting from access

$
0
0
i have a listview that i want to convert the access to excel

everything shows fine except the date that shows some numbers intead of the real date
this is my code
Code:

Private Sub BttnExcel_Click()

    Dim rs As Recordset
 
    Dim sql As String
    Dim xlApp As New Excel.Application
    Dim xlwk As New Excel.Workbook
    Dim i As Long
    screen.MousePointer = vbHourglass
    Set rs = New Recordset
    rs.LockType = adLockOptimistic
    rs.CursorType = adOpenKeyset
   
   
    sql = "Select * from Customers"
 
    rs.Open sql, CN, , adLockOptimistic
    xlApp.Interactive = True
    Set xlwk = xlApp.Workbooks.Open(App.Path & "\ExcelInventory\ExcelReport.xls")
   
 
    xlApp.Range("A" & Trim(Str(1))).Value = "Oxygen cust"
    xlApp.Range("B" & Trim(Str(1))).Value = "HairColour cust "
    xlApp.Range("C" & Trim(Str(1))).Value = "Cellular cust"
    xlApp.Range("D" & Trim(Str(1))).Value = "Phone cust"
    xlApp.Range("E" & Trim(Str(1))).Value = "Email cust"
    xlApp.Range("F" & Trim(Str(1))).Value = "Facebook cust"
  xlApp.Range("G" & Trim(Str(1))).Value = "DateBirth"
    xlApp.Range("H" & Trim(Str(1))).Value = "Address cust"
    xlApp.Range("I" & Trim(Str(1))).Value = "FullName cust"
    i = 2
   

    Do Until rs.EOF
   
        xlApp.Range("A" & Trim(Str(i))).Value = rs!Oxygen
        xlApp.Range("B" & Trim(Str(i))).Value = rs!HairColour
        xlApp.Range("C" & Trim(Str(i))).Value = rs!Cellular
        xlApp.Range("D" & Trim(Str(i))).Value = rs!Phone
        xlApp.Range("E" & Trim(Str(i))).Value = rs!Email
        xlApp.Range("F" & Trim(Str(i))).Value = rs!Facebook
        xlApp.Range("G" & Trim(Str(i))).Value = rs!DateBirth
        xlApp.Range("H" & Trim(Str(i))).Value = rs!Address
        xlApp.Range("I" & Trim(Str(i))).Value = rs!FullName
 
        i = i + 1
     
        rs.MoveNext
    Loop
 
    xlApp.Visible = True
    screen.MousePointer = vbNormal
End sub


Viewing all articles
Browse latest Browse all 21096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>