我执行下面的程序,可他告诉我"未找到方法或数据成员" Option Explicit Dim rs As New ADODB.Recordset
Private Function check1() As Boolean On Error GoTo errh Set rs = cn.Execute("SELECT num FROM room1 WHERE num='" & Trim(num.Text) & "'") If rs.EOF Then rs.Close check1 = True Exit Function End If check1 = False rs.Close Exit Function errh: rs.Close MsgBox Err.Description End Function
Private Sub Command1_Click(Index As Integer) On Error GoTo AddErr
If num.Text = "" Then MsgBox "请输入教室号!", vbOKOnly + vbExclamation, "警告" num.SetFocus Exit Sub End If If chair.Text = "" Then MsgBox "请输入桌椅数量!", vbOKOnly + vbExclamation, "警告" chair.SetFocus Exit Sub End If If Combo1.Text = "" Then MsgBox "请输入是否有投影仪!", vbOKOnly + vbExclamation, "警告" Combo1.SetFocus Exit Sub End If If window.Text = "" Then MsgBox "请输入窗户数量!", vbOKOnly + vbExclamation, "警告" window.SetFocus Exit Sub End If If door.Text = "" Then MsgBox "请输入门数量!", vbOKOnly + vbExclamation, "警告" door.SetFocus Exit Sub End If If text6.Text = "" Then MsgBox "请输入分发日期!出生年月应输入日期格式(YYYY-MM-DD)!", vbOKOnly + vbExclamation, "警告" text6.SetFocus Exit Sub End If If person.Text = "" Then MsgBox "请输入负责人姓名!", vbOKOnly + vbExclamation, "警告" person.SetFocus Exit Sub End If If tool.Text = "" Then MsgBox "请输入工具数量!", vbOKOnly + vbExclamation, "警告" tool.SetFocus Exit Sub End If If note.Text = "" Then MsgBox "请输入注释信息!", vbOKOnly + vbExclamation, "警告" note.SetFocus Exit Sub End If If Combo2.Text = "" Then MsgBox "请输入是否有电脑!", vbOKOnly + vbExclamation, "警告" Combo2.SetFocus Exit Sub End If
Exit Sub End If
If check1 = False Then MsgBox "教室号重复!", vbOKOnly + vbExclamation, "警告" num.SetFocus Else Adodc1.Recordset.AddNew Adodc1.Recordset.Fields("num").Value = num.Text Adodc1.Recordset.Fields("desk").Value = desk.Text Adodc1.Recordset.Fields("window").Value = window.Text Adodc1.Recordset.Fields("Projector").Value = Combo1.Text Adodc1.Recordset.Fields("date").Value = text6.Text Adodc1.Recordset.Fields("door").Value = door.Text Adodc1.Recordset.Fields("led").Value = led.Text Adodc1.Recordset.Fields("person").Value = person.Text Adodc1.Recordset.Fields("note").Value = note.Text Adodc1.Recordset.Fields("computer").Value = Combo2.Text Adodc1.Recordset.Update MsgBox "添加成功!", vbOKOnly + vbExclamation, "警告" Exit Sub End If AddErr: MsgBox Err.Description Exit Sub End Sub
Private Sub Command4_Click(Index As Integer) Unload Me End Sub