Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
   MsgBox ("帐号~~~密码~~~取款额~~~都不能为空")
   Text1.SetFocus
Else
     If Not IsNumeric(Text1.Text) Then
       MsgBox ("帐号必须为数字~~~~~~")
       Text1.Text = ""
       Text1.SetFocus
      Else
          If Not IsNumeric(Text3.Text) Or Val(Text3.Text) <= 0 Then
                          MsgBox ("取款额必须为大于 0 的正数~~~~~~")
                          Text3.Text = ""
                          Text3.SetFocus
          Else
                          
                          
                               
                               db_link
                               rs.Open "开户信息表", conn, adOpenDynamic, adLockBatchOptimistic
                               rs.Find "帐号='" & Text1.Text & " '"
                               If rs.EOF Then
                                   db_close
                                   MsgBox ("无此帐号,请重新输入`````")
                                   'rs.MoveFirst
                                   Text1.Text = ""
                                   Text1.SetFocus
                               Else
                                    '定位 到 帐号后 怎么在  datagrid1 “数据控件”里  
                                    '显示该 记录的其它 字段``?
                                          
                                    
                               End If          End If       End If
End If
End Sub

解决方案 »

  1.   

    Private Sub Command1_Click()
    If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
       MsgBox "帐号~~~密码~~~取款额~~~都不能为空"
       Text1.SetFocus
       Exit Sub
    End IfIf Not IsNumeric(Text1.Text) Then
       MsgBox ("帐号必须为数字~~~~~~")
       Text1.Text = ""
       Text1.SetFocus
       Exit Sub
    End IfIf Not IsNumeric(Text3.Text) Or Val(Text3.Text) <= 0 Then
       MsgBox ("取款额必须为大于 0 的正数~~~~~~")
       Text3.Text = ""
       Text3.SetFocus
       Exit Sub
    End If
                              
       db_link
       rs.Open "开户信息表", conn, adOpenDynamic, adLockBatchOptimistic
       rs.Find "帐号='" & Text1.Text & "'"
       If rs.EOF Then
           db_close
           MsgBox ("无此帐号,请重新输入`````")
           'rs.MoveFirst
           Text1.Text = ""
           Text1.SetFocus
       Else
           '定位 到 帐号后 怎么在  datagrid1 “数据控件”里  
           '显示该 记录的其它 字段``?
           set datagrid1.datasource = rs
       End IfEnd Sub
      

  2.   

    好象,不是很理想``````定位的记录后,那个datagrid1 还是显示表中的 其它记录``````比如说 帐号   余额    身份证 
    1      20。0   2121
    2      30。9   32123我只想在  datagrid1 里显示  
    帐号    身份证号
    2         32123这一条记录```怎么办`` 
      

  3.   


    rs.open "select * from 开户信息表 where 帐户='" & text1.text & "'",conn,adOpenDynamic, adLockBatchOptimisticif rs.eof thenelse
        set datagrid1.datasource = rs
            datagrid1.refresh
    endif
      

  4.   

    程序 还有一个 问题``````那就是  在单击 command1后, 如果再单击 command1, 不在set datagrid1.datasource = rs后加上 
    rs.close
    set rs=nothing
    这两句 ,程序提示 
    对象打开时,操作不被允许
    但是加上后,datagrid1 又不显示了```该怎么办`???
      

  5.   

    to  aektnick(雨)  rs.open "select * from 开户信息表 where 帐户='" & text1.text & "'",conn,adOpenDynamic, adLockBatchOptimistic  这句提示有错:至少一个参数没有被指定值
      

  6.   

    to  aektnick(雨)  
    还是那一句错``标准表达式中数据类型不匹配``````````rs.Open "select * from 开户信息表 where 帐号='" & Text1.Text & "'", conn, adOpenDynamic, adLockBatchOptimistic