Base: Problem trying to navigate between records using macro

Edit - Copy of original main post:

Base: Trying to navigate between records as described in Base Guide 6.4 page 361. oForm.next works fine but oForm.previous doesn’t. What am I doing wrong?

Sub Add_Section()			'Move to next record

	Dim oDoc As Object
	Dim oDrawpage As Object
	Dim oForm As Object
	
	oDoc = thisComponent
	oDrawpage = oDoc.drawpage
	oForm = oDrawpage.forms.getByName("frmData")
	
	oForm.next				'This works
	
End Sub

Sub Remove_Section()		'Move to previous record

	Dim oDoc As Object
	Dim oDrawpage As Object
	Dim oForm As Object
	
	oDoc = thisComponent
	oDrawpage = oDoc.drawpage
	oForm = oDrawpage.forms.getByName("frmData")
	
	oForm.previous			'This doesn't
	
End Sub

End editing for clarity - @Ratslinger

@DaleW

Please keep main title short. Explanation can go in the detail section.

Hello,

Have you considered you are on the first record and there is no previous?

bResult = oForm.previous() would return False if no previous.

Edit:

Did test your macros as posted and had no problem in a Base HSQLDB embedded file.

Interesting. I called Add_Section several times and watched the record pointer advance through the table and then tried Remove_Section, which didn’t move the pointer back. I then posed the question.

Having awaited the answer overnight, I switched on this morning and, hey presto, it worked. It looks like the macro wasn’t linking properly with the database. Thanks.