iT邦幫忙

0

ACCESS VBA執行時發生"jet資料庫引擎無法找到物件"

在下寫了一小段VBA將查詢表單轉至excel
但出現2個異常:
1.模組的"執行"按鈕是灰色的沒法按
2.至設計模式下執行時,會出現錯誤:

jet資料庫引擎無法找到物件

請各位大大可否幫忙看一下那兒有錯?
原始檔如下:
http://min.us/mbiEZvJGzG/2
1個是emp.mdb,另一個是員工.xls

另一個下載位置:
https://rapidshare.com/files/1241167939/emp.mdb
https://rapidshare.com/files/1714369419/員工.xls
請在中間下方
Save File to...
...your computer.
按底下的綠色"DOWNLOAD"鍵即可下載

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

4
dave3388
iT邦新手 4 級 ‧ 2012-06-18 22:57:14
最佳解答

Function 轉出資料到excel()
On Error GoTo 轉出資料到excel_Err
Dim strPassword As String
Dim strFilePath As String

strPassword = ""
strFilePath = "D:\aaaa.xls"
If (MsgBox("確定要轉到excel應收帳款嗎?", 1) = 1) Then
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "員工查詢", strFilePath, True, ""
DoCmd.TransferSpreadsheet acExport, 8, "查詢員工", strFilePath, True, ""
Beep
MsgBox "轉excel成功!", vbInformation, ""
Else
Beep
MsgBox "轉excel失敗!", vbInformation, ""
End If

轉出資料到excel_Exit:
Exit Function

轉出資料到excel_Err:
MsgBox Error$
Resume 轉出資料到excel_Exit

End Function

我要發表回答

立即登入回答