实时错误 '-2147467259(80004005)
实时错误 '-2147467259(80004005)[Microsoft][ODBC驱动程序管理器]未发现数据源名称并且未指定默认驱动程序
代码
Dim db As New ADODB.Connection
Private Sub Command1_Click()
Adodc1.RecordSource = "select f.fnumber as 物料代码,f.fname as 物料名称,f.fmodel as 规格型号,b.FAuxQty as 计划生产数量,d.fname as 生产车间,b.FCheckDate as 制单日期, b.FNote as 备注 from ICMo b,t_user c,t_department d,t_measureunit e,t_icitem f Where b.FBillerID = c.fuserid And b.FWorkShop = d.fitemid And b.FUnitID = e.fmeasureunitid And b.fitemid = f.fitemid And b.FCheckDate between'" & DTPicker1.Value & "' And '" & DTPicker2.Value & "'"
Adodc1.Refresh
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Dim i As String
i = Text1.Text
Adodc1.RecordSource = "select f.fnumber as 物料代码,f.fname as 物料名称,f.fmodel as 规格型号,b.FAuxQty as 计划生产数量,d.fname as 生产车间,b.FCheckDate as 制单日期, b.FNote as 备注 from ICMo b,t_user c,t_department d,t_measureunit e,t_icitem f Where b.FBillerID = c.fuserid And b.FWorkShop = d.fitemid And b.FUnitID = e.fmeasureunitid And b.fitemid = f.fitemid and d.fname like '%" & Trim(i) & "%'"
Adodc1.Refresh
End Sub
Private Sub Command4_Click()
Dim ex As Object
Dim exwbook As Object
Dim exsheet As Object
Dim k As Integer
Set ex = CreateObject("excel.application")
Set exwbook = Nothing
Set exsheet = Nothing
Set exwbook = ex.workbooks().Add
Set exsheet = exwbook.worksheets("sheet1")
'MsgBox MSFlexGrid1.TextMatrix(0, 0)
Set conn = CreateObject("adodb.connection")
conn.Open connecstring 'CONNECSTRING连接字符串
rs = conn.Execute("select * from abc")
k = 1
CommonDialog1.Filter = "*.xls|*.xls"
CommonDialog1.ShowSave
If CommonDialog1.FileTitle <> "" Then
Do
ex.range("a" & k) = rs.Fields!A
ex.range("b" & k) = rs.Fields!B
ex.range("c" & k) = rs.Fields!C
ex.range("d" & k) = rs.Fields!C
ex.range("e" & k) = rs.Fields!e
k = k + 1
rs.MoveNext
Loop
exwbook.saveas CommonDialog1.FileName
MsgBox "导出成功,请到" & CommonDialog1.FileName & "下查看!", vbOKOnly + vbInformation, "提示"
End If
ex.quit
End Sub
我想在把EXE文件导入到EXCLE中,运行时出现上述错误 --------------------编程问答-------------------- &apos 去掉 --------------------编程问答-------------------- &aposz在代码中是没有的,刚不知道是怎么加上去的
不过还是谢谢
补充:VB , 基础类