将值从Excel工作表导出到Access记录 [英] Export value from Excel worksheet to Access record

查看:74
本文介绍了将值从Excel工作表导出到Access记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Excel电子表格,其中包含访问数据库中表中记录的primarky-key/id值.

I have an excel spreadsheet that contains the primarky-key/id value for a record in a table in an access database.

我想将特定数据从电子表格中的某些单元格导出到表中相应记录的某些字段中.

I would like to export specific data from certain cells in the spreadsheet to certain fields in the corresponding record in the table.

是否有可能,任何帮助将不胜感激.

Is this possible, any help would be greatly appreciated.

非常感谢

Noel

推荐答案

您可以将ADO与Excel和Access一起使用.您可以打开Access记录集并更新或添加字段(列)并一一记录,或者可以使用带有IN关键字或内部连接字符串的SQL语句.

You can use ADO with Excel and Access. You can either open an Access recordset and update or add fields (columns) and records one by one, or you can use an SQL statement with IN key word or an internal connection string.

非常粗略:

strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\docs\mydb.mdb"

Set cn = CreateObject("ADODB.Connection")

cn.Open strCon

strSQL="SELECT * INTO NewTable  FROM [Sheet1$] IN '' " _
  & "[Excel 8.0;HDR=YES;IMEX=2;DATABASE=C:\Docs\WB.xls]"

cn.Execute strSQL

这篇关于将值从Excel工作表导出到Access记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆