แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kapiak

หน้า: [1]
1
แก้เป็นแบบนี้ครับ ในส่วนของ Import()

โค๊ด: [Select]
Sub Import()
    Dim strPath As String
    Dim strFile As String
    Dim strTable As String
    Dim StrFileName As String
    Dim strextensionNew As String
   
    strTable = "Table1"
    strPath = "D:\textfile\"
    strFile = Dir(strPath & "*.txt")
   
    Do While strFile <> ""
    StrFileName = strPath & strFile
    DoCmd.TransferText acImportDelim, "", strTable, StrFileName, False
    strextensionNew = Left(StrFileName, InStrRev(StrFileName, ".") - 1) & ".xxx"
   
    If Len(Dir$(strextensionNew)) > 0 Then
                Kill strextensionNew
    End If
    Name StrFileName As strextensionNew

    strFile = Dir(strPath & "*.txt")
    Loop
End Sub
โพสต์นี้ได้รับคำขอบคุณจาก: kapiak

2
เข้าใจครับ มันก็ต้องใช้ แบบที่ผมบอกอยู่ดี
โพสต์นี้ได้รับคำขอบคุณจาก: kapiak

3
ห้อง MS Access / : การ export to text
« เมื่อ: 20 ก.ย. 61 , 11:08:57 »
ไม่เอาหัวฟิลมาด้วย เอา -1 ข้างหลังออกครับ
ส่วนข้อมูลสุดท้าย ก็ทำคิวรีให้ออก ข้อมูลสุดท้ายงัยครับ
โพสต์นี้ได้รับคำขอบคุณจาก: kapiak

4
ห้อง MS Access / : การ export to text
« เมื่อ: 20 ก.ย. 61 , 10:18:45 »
วิธีการของ อ.Yeadram ผมก็ไม่เข้าใจนะ
ลองวิธีง่ายๆ แบบผมดู



1.ให้คลิกขวาเลือกส่งออกเป็น TextFile จะขึ้นตามรูป
2.เลือก Advace ตรงกล่องที่ 2 เราอยากให้เป็น คอมม่า ก็เลือกคอมม่า
3.ลองส่งออกมาดูว่าใช่แบบที่ต้องการรึป่าว ถ้าใช่
4.ก็ SAVE รูปแบบไว้ แล้วนำชื่อที่ SAVE ไว้ มาใส่ในโคต
Ex
DoCmd.TransferText acExportDelim, "ชื่อโคตที่SAVE", ชื่อQuery, "C:\" & "ชื่อไฟล์.txt", -1

โพสต์นี้ได้รับคำขอบคุณจาก: kapiak

หน้า: [1]