Private Function SuppInfo_Add() As Boolean
Dim rst As New ADODB.Recordset
Dim strSQL As String
Dim intRst As Integer
SuppInfo_Add = False
If CheckFaceIsOk = False Then
Exit Function
End If
strSQL = "SELECT * FROM 入库 where 编号 = " & Me.txt5.Text & ""
rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
rst.AddNew
rst.Fields("名称").Value = Me.txt1.Text
rst.Fields("入库时间").Value = Me.DT_RegeditDate.Value
rst.Fields("仓管员").Value = Me.txt2.Text
rst.Fields("入库数量").Value = Me.txt3.Text
rst.Fields("编号").Value = Me.txt5.Text
rst.Fields("入库人").Value = Me.txt6.Text
rst.Fields("线体").Value = Me.txt8.Text
If Me.txt4.Text = "" Then
rst.Fields("备注").Value = "无"
Else
rst.Fields("备注").Value = Me.txt4.Text
End If
On Error Resume Next
rst.Update
MsgBox "添加新的物品信息成功!"
Set rst = Nothing
kucun_Add
Initial_Add
SuppInfo_Add = False
Exit Function
End Function数据库连接
Option Explicit
Public cnnDatabase As New ADODB.Connection
Public strNowUser As String
Public flagAddSupplier As Boolean
Public flagAddCustomer As Boolean
Public Function ConnectDB() As Boolean
On Error GoTo ErrorHandle
Dim e As ADODB.Error
ConnectDB = True
cnnDatabase.Errors.Clear
cnnDatabase.CommandTimeout = 60
cnnDatabase.ConnectionTimeout = 60
cnnDatabase.ConnectionString = "driver={microsoft access driver (*.mdb)}; dbq=" _
& App.Path & "\yanruyue.mdb"
cnnDatabase.Open
Exit Function
ErrorHandle:
If cnnDatabase.Errors.Count < 1 Then
MsgBox Err.Description, vbOKOnly + vbExclamation
Else
For Each e In cnnDatabase.Errors
MsgBox e.Description
Next e
End If
ConnectDB = False
Set cnnDatabase = Nothing
Exit Function
End FunctionPublic Function MSFBackColor(msf As MSFlexGrid, i As Integer)
Dim coli As Integer
With msf
.Row = i
For coli = 0 To Int((.Cols - 1) / 2)
.Col = 2 * coli
.CellBackColor = &HC0FFFF
Next
End With
End Function
实时错误 '-2147217904 (80040e10)'
[Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1
Dim rst As New ADODB.Recordset
Dim strSQL As String
Dim intRst As Integer
SuppInfo_Add = False
If CheckFaceIsOk = False Then
Exit Function
End If
strSQL = "SELECT * FROM 入库 where 编号 = " & Me.txt5.Text & ""
rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
rst.AddNew
rst.Fields("名称").Value = Me.txt1.Text
rst.Fields("入库时间").Value = Me.DT_RegeditDate.Value
rst.Fields("仓管员").Value = Me.txt2.Text
rst.Fields("入库数量").Value = Me.txt3.Text
rst.Fields("编号").Value = Me.txt5.Text
rst.Fields("入库人").Value = Me.txt6.Text
rst.Fields("线体").Value = Me.txt8.Text
If Me.txt4.Text = "" Then
rst.Fields("备注").Value = "无"
Else
rst.Fields("备注").Value = Me.txt4.Text
End If
On Error Resume Next
rst.Update
MsgBox "添加新的物品信息成功!"
Set rst = Nothing
kucun_Add
Initial_Add
SuppInfo_Add = False
Exit Function
End Function数据库连接
Option Explicit
Public cnnDatabase As New ADODB.Connection
Public strNowUser As String
Public flagAddSupplier As Boolean
Public flagAddCustomer As Boolean
Public Function ConnectDB() As Boolean
On Error GoTo ErrorHandle
Dim e As ADODB.Error
ConnectDB = True
cnnDatabase.Errors.Clear
cnnDatabase.CommandTimeout = 60
cnnDatabase.ConnectionTimeout = 60
cnnDatabase.ConnectionString = "driver={microsoft access driver (*.mdb)}; dbq=" _
& App.Path & "\yanruyue.mdb"
cnnDatabase.Open
Exit Function
ErrorHandle:
If cnnDatabase.Errors.Count < 1 Then
MsgBox Err.Description, vbOKOnly + vbExclamation
Else
For Each e In cnnDatabase.Errors
MsgBox e.Description
Next e
End If
ConnectDB = False
Set cnnDatabase = Nothing
Exit Function
End FunctionPublic Function MSFBackColor(msf As MSFlexGrid, i As Integer)
Dim coli As Integer
With msf
.Row = i
For coli = 0 To Int((.Cols - 1) / 2)
.Col = 2 * coli
.CellBackColor = &HC0FFFF
Next
End With
End Function
实时错误 '-2147217904 (80040e10)'
[Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1
cnnDatabase.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;Data Source=" & App.Path & "\yanruyue.mdb"