parry
MrExcel MVP
- Joined
- Aug 20, 2002
- Messages
- 3,355
Hi, I am doing doing some test code so I can get to grips with using recordsets, but I want to do this inside a stand alone module but be able to affect a form.
The following code I want to move to the last record but nothing happens. Could someone please tell me how to make it go to the next record.
I have created a button on the form to run the stand alone module procedure as I do not want this code in the form itself.
Code in the form frmAlbum
Private Sub Command31_Click()
Call Module1.Test
End Sub
Code in Module1
Public Sub Test()
Dim RstCl As Recordset, MySch, MyCnt As Integer
Set RstCl = Forms!frmalbum.RecordsetClone()
'Display the number of records in the form
MsgBox RstCl.RecordCount 'This line works fine
'Move to the next record
RstCl.MoveNext ' nothing happens - doesnt move to next record
'RstCl.Bookmark 'This line gets a Invalid Use of property error
'Close recordset
'RstCl.Close
End Sub
cheers
parry
The following code I want to move to the last record but nothing happens. Could someone please tell me how to make it go to the next record.
I have created a button on the form to run the stand alone module procedure as I do not want this code in the form itself.
Code in the form frmAlbum
Private Sub Command31_Click()
Call Module1.Test
End Sub
Code in Module1
Public Sub Test()
Dim RstCl As Recordset, MySch, MyCnt As Integer
Set RstCl = Forms!frmalbum.RecordsetClone()
'Display the number of records in the form
MsgBox RstCl.RecordCount 'This line works fine
'Move to the next record
RstCl.MoveNext ' nothing happens - doesnt move to next record
'RstCl.Bookmark 'This line gets a Invalid Use of property error
'Close recordset
'RstCl.Close
End Sub
cheers
parry