This is giving me a headache. I cant find an answer after a day mining the internet.
I have a main form with two combo's and a subform (as as datasheetform) and another subform (also as datasheet), so a 3-level form. With buttons on the main form I transfer data from combo to combo and these events trigger a requery of both comboboxes. Now of course, as a result of the requery the record pointer of the lowest subform moves to the first record in the datasheet. I expected this and I wanted to go back to the original position by storing the ID of a (keyindex) field of the pointer before the requery and do a findfirst method on the cloned recordset after the requery of the comboboxes followed by a bookmark method. Part of this last code looks like this:
Public Sub setrecordpointer()
ActionIDpointer = Me!frmlProfilesubform!frmActionssubform.Form!.ActionID
Set rst3 = Me!frmlProfilesubform!frmActionssubform.Form!.RecordsetClone
With rst3
.FindFirst "ActionID=" & Str(ActionIDpointer)
If .NoMatch Then
MsgBox "no record found"
End If
End With
Me!frmlProfilesubform!frmActionssubform.Form!.Bookmark = rst3.Bookmark
End Sub
For some reason this doesnt work at all. The pointer is still at the first record. I've inserted some msgboxes in the code to read the status of the variables and then the code works. Of course I dont want these msgboxes in the end product. Does anyone have a solution??
I have a main form with two combo's and a subform (as as datasheetform) and another subform (also as datasheet), so a 3-level form. With buttons on the main form I transfer data from combo to combo and these events trigger a requery of both comboboxes. Now of course, as a result of the requery the record pointer of the lowest subform moves to the first record in the datasheet. I expected this and I wanted to go back to the original position by storing the ID of a (keyindex) field of the pointer before the requery and do a findfirst method on the cloned recordset after the requery of the comboboxes followed by a bookmark method. Part of this last code looks like this:
Public Sub setrecordpointer()
ActionIDpointer = Me!frmlProfilesubform!frmActionssubform.Form!.ActionID
Set rst3 = Me!frmlProfilesubform!frmActionssubform.Form!.RecordsetClone
With rst3
.FindFirst "ActionID=" & Str(ActionIDpointer)
If .NoMatch Then
MsgBox "no record found"
End If
End With
Me!frmlProfilesubform!frmActionssubform.Form!.Bookmark = rst3.Bookmark
End Sub
For some reason this doesnt work at all. The pointer is still at the first record. I've inserted some msgboxes in the code to read the status of the variables and then the code works. Of course I dont want these msgboxes in the end product. Does anyone have a solution??