สร้างปุ่มสำหรับเรียกโฟลเดอร์สำหรับการ แนบไฟล์ แทนการคลิกเลือกที่ฟิลAttachment


0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

23 ต.ค. 62 , 15:29:44
อ่าน 941 ครั้ง

pondniizz

สอบถามอาจารยบ์ทุกท่านค่ะ

การใช้โค้ดเพื่อสร้างปุ่ม สำหรับ เลือกไฟล์มาไว้ที่ฟิลด์ Attachment โดยได้โค้ดมาดังนี้ค่ะ 

โค๊ด: [Select]
Private Sub Command7_Click()
On Error GoTo Err_AddImage
 Dim dbs As DAO.Database
 Dim rst As DAO.Recordset
 Dim rsChild As DAO.Recordset
 Set dbs = CurrentDb
 Set rst = dbs.OpenRecordset("SELECT * FROM Table1")


 rst.Edit

 Set rsChild = rst.Fields("attachmentTest").Value
    'Add a new attachment.
    filePath = "D:\"
    rsChild.AddNew
    rsChild.Fields("FileData").LoadFromFile (filePath)
    rsChild.Update
    'Update the parent record
    rst.Update
Exit_AddImage:
 Set rsChild = Nothing
 Set rsParent = Nothing
 Exit Sub
Err_AddImage:
 If Err = 3820 Then
 MsgBox ("File already part of the multi-valued field!")
 Resume Next
 Else
 MsgBox "Some Other Error occured!" & Err.Number & Err.Description
 Resume Exit_AddImage
 End If
End Sub

แต่ติด Error คะ รบกวนอาจารย์ทุกท่านช่วยหน่อยนะคะ
ความต้องการคือ ต้องการ สร้างปุ่มสำหรับเรียกโฟลเดอร์สำหรับการ แนบไฟล์ แทนการคลิกเลือกที่ฟิลAttachment

ที่มาข้อมูล :https://www.thongjoon.com/2013/07/access-2010.html

 

23 ต.ค. 62 , 22:38:07
ตอบกลับ #1

Max

ลองดูคลิปนี้ยังครับ ผมทำเป็นเพราะคลิป อ. TTT เลยครับ

 


บอร์ดเรียนรู้ Access สำหรับคนไทย


 

Sitemap 1 2 3 4 5