|
-
Jun 20th, 2002, 12:32 AM
#1
Thread Starter
Member
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!
-
Jun 20th, 2002, 12:38 AM
#2
-
Jun 20th, 2002, 12:41 AM
#3
Re: about Database record please help me
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
-
Jun 20th, 2002, 12:46 AM
#4
PowerPoster
Create the variable in the General declaration section of the form.
-
Jun 20th, 2002, 12:47 AM
#5
Thread Starter
Member
Private Sub nextrecord_Click()
rs.MoveNext "there is a mistake,message:"no with variable"
If Not rs.EOF Then
rs.MoveNext
txtFields.Text = rs.Fields(0).Value
End If
End Sub
-
Jun 20th, 2002, 12:54 AM
#6
Thread Starter
Member
Create the variable in the General declaration section of the form.
__________________
Amitabh Kant //////
I had done it.
example:
Option Explicit
Const DBName As String = "\db197.mdb"
Dim strPath As String
Dim db As Database
Dim strsql As String
Dim blnview As Boolean
Dim rs As Recordset
-
Jun 20th, 2002, 12:59 AM
#7
i forgot...
VB Code:
Option Explicit
Const DBName As String = "\db197.mdb"
Dim strPath As String
Dim db As Database
Dim strsql As String
Dim blnview As Boolean
Dim rs As Recordset
Private Sub Form_load()
set rs = new recordset
strsql = "select username from regedit "
Set rs = db.OpenRecordset(strsql)
end sub
Private Sub nextrecord_Click()
rs.movenext
if rs.eof then
rs.movelast
end if
txtFields.Text = rs.Fields(0).Value
End Sub
-
Jun 20th, 2002, 01:05 AM
#8
Thread Starter
Member
set rs = new recordset/////////message:"invalidation use new keys.
-
Jun 20th, 2002, 01:11 AM
#9
This is humiliating...
-
Jun 20th, 2002, 01:19 AM
#10
Thread Starter
Member
message:"no function or sub was defined!"
-
Jun 20th, 2002, 01:28 AM
#11
-
Jun 20th, 2002, 01:43 AM
#12
Thread Starter
Member
no matter.
thank u very much.
I had seen that an article,But I don't know how to do it yet.
So can you tell me about it detailly?
:-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|