您好,方法有很多的
例如
局域網(wǎng)中有Sharepoint服務(wù)端,可以直接通過Excel訪問服務(wù)端上的數(shù)據(jù)庫,
如下圖,但Sharepoint似乎并不是非常普及,所以還提供了其他方法
以下是最適合新手的最簡方法,只要求Excel/Access及局域網(wǎng)的通暢不需要其他工具或知識,假設(shè)要與Access連接的Excel表格如下:
3.打開Access,點擊外部數(shù)據(jù)(如下圖所示),再點擊Excel(如下圖所示)
4.點擊【瀏覽】或直接輸入Excel路經(jīng),局域網(wǎng)中要先將Excel文檔共享,
選中【通過創(chuàng)建鏈接表....】項,單擊【確定】
5.如果Excel中數(shù)據(jù)包含分類標題,例如“姓名”、"性別"等,請勾選【第一行包含標題】,點擊【下一步】或【完成】即可完成對接
注意:
1.此方法的缺點在于僅限單向連接,即Excel端發(fā)生更改,Access端可同步接收Excel的數(shù)據(jù)變動,但在Access端無法對數(shù)據(jù)進行操作
2.務(wù)必常常對Access進行存檔,否則Excel端關(guān)閉后Access端可能發(fā)生數(shù)據(jù)丟失
拓展:
另外還可以通過VB創(chuàng)建控件的方法,在IE中進行數(shù)據(jù)的瀏覽與更改,此方法將同時同步Excel與Access中的數(shù)據(jù),但需要一定的VB編程基礎(chǔ),這里提供源碼,有興趣可以研究研究,并不是很難
Imports SystemImports System.Windows.FormsImports Microsoft.Office.Excel.WebUIImports Microsoft.SharePointImports Microsoft.SharePoint.WebPartPagesNamespace AddEWATool ''' <summary> ''' Form1 class derived from System.Windows.Forms. ''' </summary> Partial Public Class Form1 Inherits Form Private appName As String = "AddEWATool" Private specifyInputError As String = "Please add a site URL, for example,
http://myserver/site/" Private openSiteError As String = "There was a problem with the site name. Please check that the site exists." Private addWebPartError As String = "There was a problem adding the Web Part." Private successMessage As String = "Web Part successfully added." ''' <summary> ''' Add the Excel Web Access Web Part to the Default.aspx page of the specified site. ''' </summary> ''' <param name="siteName">URL of the SharePoint site</param> ''' <param name="book">URI to the workbook</param> ''' <returns>Returns true if the WebPart was successfully added; otherwise, false.</returns> Public Function AddWebPart(ByVal siteName As String, ByVal book As String) As Boolean Dim site As SPSite = Nothing Dim targetWeb As SPWeb = Nothing Dim webPartManager As SPLimitedWebPartManager = Nothing Dim b As Boolean = False progressBar1.Visible = True progressBar1.Minimum = 1 progressBar1.Maximum = 4 progressBar1.Value = 1 progressBar1.Step = 1 If String.IsNullOrEmpty(siteName) Then MessageBox.Show(specifyInputError, appName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Return b End If Try Try site = New SPSite(siteName) targetWeb = site.OpenWeb() Catch exc As Exception MessageBox.Show(openSiteError & vbLf & exc.Message, appName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk) progressBar1.Value = 1 Return b End Try progressBar1.PerformStep() Try ' Get the shared Web Part manager on the Default.aspx page. webPartManager = targetWeb.GetLimitedWebPartManager( _ "Default.aspx", _ System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared) Catch exc As Exception MessageBox.Show(openSiteError & vbLf & exc.Message, appName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk) progressBar1.Value = 1 Return b End Try progressBar1.PerformStep() 'Instantiate Excel Web Access Web Part. 'Add an Excel Web Access Web Part in a shared view. Dim ewaWebPart As New ExcelWebRenderer() ewaWebPart.WorkbookUri = book progressBar1.PerformStep() Try webPartManager.AddWebPart(ewaWebPart, "Left", 0) Catch exc As Exception MessageBox.Show(addWebPartError & vbLf & exc.Message, appName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk) progressBar1.Value = 1 Return b End Try Finally If Not IsNothing(site) Then site.Dispose() End If If Not IsNothing(targetWeb) Then targetWeb.Dispose() End If If Not IsNothing(webPartManager) Then webPartManager.Dispose() End If End Try progressBar1.PerformStep() b = True Return b End Function ''' <summary> ''' AddEWAButton click handler. ''' </summary> ''' <param name="sender">caller</param> ''' <param name="e">event</param> Private Sub AddEWAButton_Click(ByVal sender As Object, ByVal e As EventArgs) Dim siteUrl As String = textBox1.Text Dim bookUri As String = textBox2.Text Dim succeeded As Boolean = AddWebPart(siteUrl, bookUri) If succeeded Then MessageBox.Show(successMessage, appName, MessageBoxButtons.OK, MessageBoxIcon.Information) progressBar1.Value = 1 End If End Sub End ClassEnd Namespace