您好,方法有很多的
例如
局域网中有Sharepoint服务端,可以直接通过Excel访问服务端上的数据库,
如下图,但Sharepoint似乎并不是非常普及,所以还提供了其他方法
以下是最适合新手的最简方法,只要求Excel/Access及局域网的通畅不需要其他工具或知识,假设要与Access连接的Excel表格如下:
3.打开Access,点击外部数据(如下图所示),再点击Excel(如下图所示)
4.点击【浏览】或直接输入Excel路经,局域网中要先将Excel文档共享,
选中【通过创建链接表....】项,单击【确定】
5.如果Excel中数据包含分类标题,例如“姓名”、"性别"等,请勾选【第一行包含标题】,点击【下一步】或【完成】即可完成对接
注意:
1.此方法的缺点在于仅限单向连接,即Excel端发生更改,Access端可同步接收Excel的数据变动,但在Access端无法对数据进行操作
2.务必常常对Access进行存档,否则Excel端关闭后Access端可能发生数据丢失
拓展:
另外还可以通过VB创建控件的方法,在IE中进行数据的浏览与更改,此方法将同时同步Excel与Access中的数据,但需要一定的VB编程基础,这里提供源码,有兴趣可以研究研究,并不是很难
Imports System
Imports System.Windows.Forms
Imports Microsoft.Office.Excel.WebUI
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.WebPartPages
Namespace AddEWATool
'''
''' Form1 class derived from System.Windows.Forms.
'''
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."
'''
''' Add the Excel Web Access Web Part to the Default.aspx page of the specified site.
'''
''' URL of the SharePoint site
''' URI to the workbook
'''
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
'''
''' AddEWAButton click handler.
'''
''' caller
''' event
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 Class
End Namespace
1,制作一个数据库
2,将数据库设置成只读,放入共享目录。
3,在你的客户机新建一个EXCEL文件,以2007版为例,选择数据-自access-网上邻居-寻找到你的所谓服务器,OK!可以了。
要刷新的话点刷新,参考图片
有方法。
将服务器上的数据库放到一个共享目录,设置为只读属性。
客户机打开EXCEL,在数据菜单里面选择导入外部数据,在打开的对话框里面,选择网上邻居,找到那个目录,打开数据库,导入数据库对话框点确定。就把数据导入进来了。
保存这个EXCEL文件。下次打开的时候,在导入的数据上面点右键,有个刷新数据。就可以看到数据库里面的最新数据。
很简单,数据菜单,合并计算(或者分类汇总),引用位置,浏览,网上邻居,找到ACCESS就可以了!