แสดงกระทู้

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 - SSukHaveq

หน้า: [1]
1
ก่อนอื่น เท่าที่ดู ผมว่าถ้าจะเทียบค่าต้องเขียนอ้างให้ตัวเลข โดยการใช้ มากว่า น้อยกว่า เทียบ String มันจะเพียนไปจากที่ตั้งใจไว้ และอีกอย่าง ผมว่าลองใช้ Between มันจะดูง่ายกว่าป่าวครับ

strCriteriaM = "([Month] between " & Me.FROMmonthtxt.Value & " and " & Me.TOmonthtxt.Value & ") and ([Year] between " & Me.FROMyeartxt.Value & " and " & Me.TOyeartxt.Value & ")"

ไม่รู้ว่าได้ตามต้องการป่าวนะครับ เป็นไอเดีย
โพสต์นี้ได้รับคำขอบคุณจาก: SSukHaveq

2
ส่งออกไป excel
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "ชื่อตารางหรือคิวรี่", "ระบุตำแหน่งไฟล์และตั้งชื่อไฟล์ที่Exportออกไป", True, "ชื่อsheetที่ต้องการ"
ตัวอย่าง
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "table1", "E:\Myexport.xls", True, "SheetData1"


นำเข้า จาก Excel to Access

หลักการคล้ายๆ กันครับเปลี่ยนจาก acExport มาเป็น acImport
เช่น
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Importเข้าTableไหน", "ตำแหน่งไฟล์และชื่อไฟล์ที่จะนำเข้า", True
ตัวอย่าง
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "MyTable", "E:\MyImport.xls", True

acSpreadsheetType นั้นลองเช็คดูนะครับ ว่าของท่านใช้ Excel รุ่นไหน

acSpreadsheetTypeExcel8      Microsoft Excel 97 format
acSpreadsheetTypeExcel9      Microsoft Excel 2000 format
acSpreadsheetTypeExcel12      Microsoft Excel 2010 format
acSpreadsheetTypeExcel12Xml   Microsoft Excel 2010/2013/2016 XML format (.xlsx, .xlsm, .xlsb)
โพสต์นี้ได้รับคำขอบคุณจาก: SSukHaveq

3
ให้ใช้ Image control สำหรับแสดงรูปภาพ โดยกำหนด Control Source ของ Image control ให้เป็น ="ไดร์ฟ:\พาธ\...\...\พาธ\" & [ชื่อเท็กซ์บ็อกซ์ของ Picturetest]
โพสต์นี้ได้รับคำขอบคุณจาก: SSukHaveq

หน้า: [1]