請問各位大大前輩先進:
小弟的這個程式在OFFICE 2003 執行起來是正常的,可是一到2010卻出現執行階段錯誤 "429",請高手們協助,謝謝
錯誤點:
Set db = Workspaces(0).OpenDatabase(datapath _
& FF)
程式碼如下:
Option Explicit
Public datapath As String
Public FF As String
Public dataSource As String, CheckDb, ar(30)
Public ExcelDB As Database, db As Database, RecSet As Recordset, NumRecs
Public RecArrary, i As Integer, j As Integer, counter As Integer, List1, Choicess
Public Sub EE()
FF = "\CALCU_RITZ.mdb"
End Sub
Sub ACESSTAKE()
Application.ScreenUpdating = True
回設計畫面
Dim txtsql As String
ActiveWorkbook.PrecisionAsDisplayed = False
C槽開檔
If Range("存取資料位置") = DD Then
檔案路徑
Else: L槽開檔
datapath = BB
End If
EE
Workbooks("GNL.xls").Sheets("INPUT").Activate
Set db = Workspaces(0).OpenDatabase(datapath _
& FF)
Set RecSet = db.OpenRecordset("MADATA", dbOpenDynaset)
RecSet.MoveFirst
txtsql = "存取編號" & "='" & Range("產品代號").Value & "'"
RecSet.FindFirst txtsql
If RecSet.Fields(1).Value <> Range("產品代號").Text Then
MsgBox "大哥! 找不到資料! 請檢查 [產品代號]"
Range("產品代號").Select
db.Close