自定义类型作为参数提示“类型不符”
求助:
以下代码出现错误………………实在找不出原因…………
错误就出现在图中的“AR8”处。这个是我自定义的类型,用在自定义的函数中。
这里是form的代码
Private Sub Form_Load()
Call DBInit
Dim AR8 As DevInfo
DBFilePath = App.Path & "\Data\test2.mdb"
CmdH = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBFilePath
If Dir(DBFilePath, vbNormal Or vbDirectory Or vbHidden Or vbReadOnly) = "" Then cat.Create CmdH
AR8.Model = AR882
AR8.ID = "01"
End Sub
Public CmdH As String
Public Cmd1 As ADODB.Command 'cmmZhuCe为命令对象
Public Cn As ADODB.Connection
Public rs As ADODB.Recordset
Public cat As New ADOX.Catalog '不用cat用另外一个名字也可以
Public DBFilePath As String
Public Type DevInfo
Model As String
ID As String
End Type
Public Function DBInit()
End Function
Public Function AddToDBIR(ByVal T As String, ByVal Tmprt As String, ByVal EMS As String, ByRef Dev As DevInfo)
Dim Str(10) As String
Dim Cmd(10) As String
Dim TB As TextBox
Cmd(0) = "Insert into "
Cmd(1) = Format(Now, "YYMMDD") & Dev.Model & " ("
Cmd(2) = "Model & ID" & ",TIME,DATA1,DATA2) values ('"
Cmd(3) = Dev.Model & "." & Dev.ID & "','" & T & "','" & Tmprt & "','" & EMS & "')"
Call OpenConn(CmdH)
Cn.Execute Cmd(0) & Cmd(1) & Cmd(2) & Cmd(3)
Call CloseConn(CmdH)
End Function