InterGladiator
Registered User.
- Local time
- Today, 08:11
- Joined
- Apr 20, 2006
- Messages
- 20
Hi,
I have a form with a text box bounded to a field of a table and a button. I want to program the button so that when the user clicks it it shows the next record in the text box.
Unfortunately I exprience two problems all the time:
1) I click the button and nothing happens. I get no error messages but the value in the text box does not change either.
2) I placed a label onto the form to see what happens. When I click the button for the first time I see the label's caption is Kit002 (second record), that is okay, the actual record is the second, great. But after that, when I click the button again and again, it remains Kit002 and does not changes to Kit003 and so on.
What is the problem? Here is my code:
Private Sub NextButton_Click()
Dim mydb As Database
Dim myset As Recordset
Set mydb = CurrentDb()
Set myset = mydb.OpenRecordset("Kits", dbOpenTable)
myset.Index = "KitID"
myset.MoveNext
Me.Label1.Caption = myset!KitID 'Just to see which is the actual record
Set mydb = Nothing
Set myset = Nothing
End Sub
Please help.
Thank you in advance,
Attila
I have a form with a text box bounded to a field of a table and a button. I want to program the button so that when the user clicks it it shows the next record in the text box.
Unfortunately I exprience two problems all the time:
1) I click the button and nothing happens. I get no error messages but the value in the text box does not change either.
2) I placed a label onto the form to see what happens. When I click the button for the first time I see the label's caption is Kit002 (second record), that is okay, the actual record is the second, great. But after that, when I click the button again and again, it remains Kit002 and does not changes to Kit003 and so on.
What is the problem? Here is my code:
Private Sub NextButton_Click()
Dim mydb As Database
Dim myset As Recordset
Set mydb = CurrentDb()
Set myset = mydb.OpenRecordset("Kits", dbOpenTable)
myset.Index = "KitID"
myset.MoveNext
Me.Label1.Caption = myset!KitID 'Just to see which is the actual record
Set mydb = Nothing
Set myset = Nothing
End Sub
Please help.
Thank you in advance,
Attila