Custom button

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
 
have you tried:

Code:
DoCmd.GoToRecord , , acNext
 
Last edited:
Thank you for the code. I tried it but I keep getting error messages:

if I use "DoCmd.GoToRecord , , acNext" then I get "Run-time error '2105' You can't go to the specified record" error message

if I use "DoCmd.GoToRecord acDataTable, "Kits", acNext" or "DoCmd.GoToRecord acDataForm, "Kits_subform", acNext" then I get "Run-time error 2489 The object 'xxx' isn't open".

Please help. Can I send you my database? It is just <50 KBs zipped. Then you could see what is the problem. I have been trying to fix this problem for 3 days without any success.

Thank you,
Attila
 

Users who are viewing this thread

Back
Top Bottom