模块内容:
Option Explicit
Public cnFriend As ADODB.Connection
Public Sub Friendconnection()
Set cnFriend = New Connection
cnFriend.ConnectionTimeout = 15
cnFriend.Open " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\hail-fellow.mdb;Persist Security Info=False"
cnFriend.CursorLocation = adUseClient
End Sub
Public Sub main()
Friendconnection
frmSplash.Show
End Sub
Public Sub EnterTab(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{Tab}"
End If
End Sub
窗体内容:
Option Explicit
Dim fr_Rec As ADODB.Recordset
Dim Acc As String
Dim Fr_Query As ADODB.Recordset
Dim Querye As String
Dim Fr_Query1 As ADODB.Recordset
Dim Querye1 As String
Dim strxm As String
Private Sub Command1_Click()
Dim tempstr As String
Set Fr_Query1 = New ADODB.Recordset
Querye1 = "select * from DataDeposited where name='" & Query.Text1(0).Text & "'"
Fr_Query1.Open Querye1, cnFriend, adOpenKeyset, adLockOptimistic, adCmdText
If Fr_Query.RecordCount <= 0 Then Exit Sub
tempstr = Fr_Query1(9) & ""
Text4.Text = tempstr
Call updataX
End Sub
Private Sub Form_Load()
Set fr_Rec = New ADODB.Recordset
Acc = "Select * From DataDeposited"
fr_Rec.Open Acc, cnFriend, adOpenKeyset, adLockOptimistic, adCmdText
Set Fr_Query = New ADODB.Recordset
Set Fr_Query = New ADODB.Recordset
Querye = "select * from DataDeposited"
Fr_Query.Open Querye, cnFriend, adOpenKeyset, adLockOptimistic, adCmdText
End Sub
Private Sub updataX()
Dim rs As New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.LockType = adLockPessimistic
rs.Index = "Name"
Set rs = New ADODB.Recordset
Set rs = cnFriend.Execute("select * from DataDeposited")
rs.Seek "=", Query.Text1(0).Text ‘————————————出错处
rs!message = Text4.Text & Text1.Text & Text2.Text & ""
rs.Update
End Sub
如上面出错,实时错误13 类型不匹配,怎样解决?