|
-
Sep 28th, 2003, 06:57 PM
#1
Thread Starter
Hyperactive Member
EOF not working right for me
Hello, in my program I have a Next and Previous button. If for example I have 14 records in my access database, I want the next button to disable itself on the 14th record (or last one). I tried the following code but it does not disable itself until one after the last entry.
VB Code:
Private Sub cmdNext_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF = True Then
cmdNext.enabled = false
End If
End Sub
I have also tried the following but it did not work:
VB Code:
Private Sub cmdNext_Click()
If Adodc1.Recordset.EOF = True Then
cmdNext.enabled = false
else
Adodc1.Recordset.MoveNext
End If
End Sub
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
-
Sep 29th, 2003, 03:46 AM
#2
Re: EOF not working right for me
If you don't include the "if" part, does it eventually give you an error? In other words, does it ever reach the EOF?
-
Sep 29th, 2003, 03:55 AM
#3
Hyperactive Member
Private Sub cmdNext_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF = True Then
cmdNext.enabled = false
Adodc1.Recordset.MoveLast
End If
End Sub
-
Sep 29th, 2003, 12:20 PM
#4
Thread Starter
Hyperactive Member
mendak, when I take away the If/Then statements, I get an error 'Compile Error: Cant assign to Read Only Property" If it is talking about my access file being Read-Only, it isn't.
Granty, I tried that code and it did not work, when I get to the last record, the cmdNext.enabled = true. If I push the button again, it will then make the button disabled.
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
-
Sep 29th, 2003, 01:17 PM
#5
Lively Member
That is correct. When you're on the last/first record EOF/BOF are gonna be false ... You should try to implement a record count and perform your enable/disable using a record count and position ...
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
|