回覆列表
  • 1 # 最NEW資訊

    你把用下面這段vba。邏輯是excel去access中取資料,而不是複製複製出來。Sub Refresh_Data()Dim Conn As New ADODB.ConnectionDim strConn As StringDim strSQL As StringDim rs As New ADODB.RecordsetDim Max_row As IntegerStpath = ThisWorkbook.Path & Application.PathSeparator & "test.accdb" "設定access檔案路徑Conn.Provider = "Microsoft.ACE.OLEDB.12.0"strConn = "Data Source =" & StpathstrSQL = "select * from report_summary""開啟資料庫Conn.Open (strConn)rs.Open strSQL, Conn, 1, 1Application.ScreenUpdating = FalseApplication.DisplayAlerts = FalseIf rs.BOF = False Then Sheets("Database").Range("A2:AY50000").ClearContents Sheets("Database").Range("A2").CopyFromRecordset rs Else Sheets("Database").Range("A2:AY10") = "0"End Ifrs.CloseSet rs = NothingConn.Closeend sub

  • 中秋節和大豐收的關聯?
  • 施工監理工作流程主要有哪些?