| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1244 人关注过本帖
标题:运行时错误'-2147217904(80040e10)':至少一个参数没有被指定值
取消只看楼主 加入收藏
shixyi37
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-2-6
收藏
 问题点数:0 回复次数:0 
运行时错误'-2147217904(80040e10)':至少一个参数没有被指定值
Sub test11()
  Dim cnn As New ADODB.Connection
  Dim rs As New ADODB.Recordset
  Dim sql As String
  Dim mybook As String
  mybook = ThisWorkbook.FullName
  With cnn
    If Application.Version = "11.0" Then
      .Provider = "microsoft.jet.oledb.4.0"
      .ConnectionString = "extended properties=""excel 8.0;HDR=YES;"";data source=" & mybook
    Else
      .Provider = "microsoft.ACE.oledb.12.0"
      .ConnectionString = "extended properties=""excel 12.0;HDR=YES;"";data source=" & mybook
    End If
    .Open
  End With
  sql = "select * from [期中$a2:e] where 编码 in (select 编码 from [期末$a2:e])"
  rs.Open sql, cnn, adOpenKeyset, adLockOptimistic
  With Worksheets("期中期末共有")
    .Range("a4").CopyFromRecordset rs
  End With

  rs.Close
  sql = "select * from [期末$a2:e] where 编码 in (select 编码 from [期中$a2:e])"
  rs.Open sql, cnn, adOpenKeyset, adLockOptimistic
  With Worksheets("期中期末共有")
    .Range("g4").CopyFromRecordset rs
  End With

  rs.Close
  sql = "select * from [期中$a2:e] where 编码 not in (select 编码 from [期末$a2:e])"
  rs.Open sql, cnn, adOpenKeyset, adLockOptimistic
  With Worksheets("期中有期末没有")
    .Range("a4").CopyFromRecordset rs
  End With

  rs.Close
  sql = "select * from [期末$a2:e] where 编码 not in (select 编码 from [期中$a2:e] where not isnull(编码))"
  rs.Open sql, cnn, adOpenKeyset, adLockOptimistic
  With Worksheets("期末有期中没有")
    .Range("a4").CopyFromRecordset rs
  End With
End Sub

运行上述宏时,出现以下错误:运行时错误'-2147217904(80040e10)':至少一个参数没有被指定值,点调试时显示错误在:rs.Open sql, cnn, adOpenKeyset, adLockOptimistic
劳烦大师们施救
搜索更多相关主题的帖子: source excel 
2015-02-06 10:31
快速回复:运行时错误'-2147217904(80040e10)':至少一个参数没有被指定值
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040202 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved