我是个vb初学者,请教在vb里能不能获得一条记录的记录号,就象vf理的recno()函数一样?比如下面的代码
If Not currec.BOF Then
  currec.MovePrevious
    RefreshForm ‘自定义函数,刷新表单
Else
    MsgBox "已是首记录!", vbOKOnly, "错误"
End If
如果当前记录是第一条,not currec.bof 就会通过,但是执行了moveprevious后,bof就成立,执行refreshform就会出错。

解决方案 »

  1.   

    adodc1.recordset.absloude... 可以得到你试试这个:
    If  currec.BOF Then
      currec.Movefirst
       MsgBox "已是首记录!", vbOKOnly, "错误"
    Else
         currec.Previous
    End If
      

  2.   

    不要用 if 语句 while 不是很好吗? 而且也是专门为 逻辑型变量设计的。这个好。
      

  3.   

    while not currec.bof
          currec.moveprevious
    wend
      

  4.   

    用sql select 出来就可以啦~还用什么记录号...
    rs.open("select * from tablename where id=1",conn,3,2)