提示参数类型不正确,或不在可以接受的范围之内,...
代码如下,提示参数类型不正确,或不在可以接受的范围之内,...请高手帮忙!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Private Sub Command1_Click()
For Index = 0 To 4 '清空所有的text
Text1(Index).Text = ""
Next
Text1(0).SetFocus
End Sub
Private Sub Command2_Click()
Dim SQL_jl As String
Dim rs As New ADODB.Recordset
If Text1(0).Text = "" Then '检查编号是否为空
MsgBox "请输入借款人编号!"
Text1(0).SetFocus
Exit Sub
End If
If Text1(1).Text = "" Then '检查姓名是否为空
MsgBox "请输入借款人姓名!"
Text1(1).SetFocus
Exit Sub
End If
If Text1(2).Text = "" Then '检查时间是否为空
MsgBox "请输入借款时间!"
Text1(2).SetFocus
Exit Sub
End If
If Text1(3).Text = "" Then '检查金额是否为空
MsgBox "请输入借款金额!"
Text1(3).SetFocus
Exit Sub
End If
If Text1(4).Text = "" Then '检查说明是否为空
MsgBox "请输入借款说明!"
Text1(4).SetFocus
Exit Sub
End If
SQL_jl = "select * from 记录 where id='" & Text1(0).Text & "'"
rs.Open SQL_jl, Conn, adOpenKeyset, adOpenStatic
If rs.EOF Then
rs.AddNew '写入数据
rs.Fields(0) = Text1(0).Text
rs.Fields(1) = Text1(1).Text
rs.Fields(2) = Text1(2).Text
rs.Fields(3) = Text1(3).Text
rs.Fields(4) = Text1(4).Text
rs.Update
MsgBox "借款记录添加成功!"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Text1(3).Text = ""
Text1(4).Text = ""
Text1(0).SetFocus
Else
MsgBox "此ID已存在,请输入新ID!"
Text1(0).Text = ""
Text1(0).SetFocus
End If
rs.Close
Set rs = Nothing
End Sub
Private Sub Command3_Click()
Unload Me
Form2.Show
End Sub
Private Sub Form_Load()
Dim Connectionstring As String
Me.Top = (Screen.Height - Me.Height) / 2 'ME代表本窗体
Me.Left = (Screen.Width - Me.Width) / 2
Set Conn = New ADODB.Connection
Conn.Connectionstring = "provider=Microsoft.Jet.oledb.4.0;" & _
"Data Source=" & App.Path & "\wlk.mdb"
Conn.Open
End Sub