【问题标题】:Extracting data from Excel to Access Database从 Excel 中提取数据到 Access 数据库
【发布时间】:2015-06-17 16:54:18
【问题描述】:

目前有一个带有字段的 Word 格式(可以使用不同的技术)的标准公司表格。

如何从这些字段中将数据提取到我的 Access DB 中?

我也愿意就哪种技术更适合我的要求提出建议,要求如下:

  1. 需要将文件发送给客户并将填写的信息添加到数据库中
  2. 能够从数据库中检索信息并以表格形式表示它

【问题讨论】:

  • 到目前为止,您的努力/研究取得了哪些进展?

标签: database excel ms-access ms-word


【解决方案1】:

将该表格翻译成 Excel。使用功能区“外部数据”选项卡下的“收集数据”从客户那里收集数据。要将数据从 Access 中提取到电子表格中,请执行以下操作。使用 Excel 电子表格作为表单。然后在点击时创建一个带有以下事件的命令按钮:

'"cmdbtn1" is the name you assign your command button.
Private Sub cmdbtn1_Click()
Dim appExcel As Excel.Application
Dim wbook As Excel.Workbook
Dim wsheet As Excel.Worksheet

Set appExcel = New Excel.Application
appExcel.Visible = True
Set wbook = appExcel.Workbooks.Open("C:\PathToYourDocument\YourSpreadsheet.xlsx")

'"YourSpreadsheet" is the name of the actual sheet in your workbook.

Set wsheet = wbook.Worksheets("YourSpreadsheet")

With wsheet

'The numbers next to ".Cells(" correspond to locations on your spreadsheet. A1=(1, 1), B1=(1,2), A2=(2, 1) 

    .Cells(10, 1).Value = txtThing1
    .Cells(10, 2).Value = txtThing2

'This is how you combine multiple cell in excel into one Access field.

    .Cells(10, 3).Value = txtThing3 + " " + txtThing4 + " " + txtThing5 + " " + Thing5

End With
End Sub

【讨论】:

  • 非常感谢,我会试试这个看看。
猜你喜欢
  • 2013-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-30
  • 1970-01-01
  • 2016-04-28
  • 1970-01-01
相关资源
最近更新 更多