about Database record please help me
Example:
Private Sub nextrecord_Click()
Dim rs As Recordset
strsql = "select username from regedit "
Set rs = db.OpenRecordset(strsql)
rs.MovePrevious
txtFields.Text = rs.Fields(0).Value
End Sub
If I click nextrecord command I can get the second record. If I click it again.I can't get the third record.So how to write these code ?
Thank u!
Re: about Database record please help me
Quote:
Originally posted by flyflydream2002
Example:
Private Sub nextrecord_Click()
Dim rs As Recordset
strsql = "select username from regedit "
Set rs = db.OpenRecordset(strsql)
rs.MovePrevious
txtFields.Text = rs.Fields(0).Value
End Sub
If I click nextrecord command I can get the second record. If I click it again.I can't get the third record.So how to write these code ?
Thank u!
OK, the following should be OUTSIDE this particular sub
Code:
'probably in form load event
Dim rs As Recordset
strsql = "select username from regedit "
Set rs = db.OpenRecordset(strsql)
Private Sub nextrecord_Click()
rs.movenext
if rs.eof then
rs.movelast
end if
txtFields.Text = rs.Fields(0).Value
End Sub
HTH