F
figaro
In the code snippet below I'm attempting to set the .Bookmark property
of a Form to match the bookmark of an ADO recordset:
Private Sub Form_Load()
Dim rst As ADODB.Recordset
Dim mctlFieldName As Control
Set rst = New ADODB.Recordset
Set mctlFieldName = Forms!frmCDs!cboFiledUnder
rst.Open Me.RecordSource, CurrentProject.Connection, _
adLockReadOnly, adCmdTable
Set rst = rst.Clone(adLockReadOnly)
rst.Find "ID=" & mctlFieldName.Value
Me.Bookmark = rst.Bookmark
When the code is run by opening the Form, I get an error:
Not a valid bookmark.
The error occurs on the line that starts Me.Bookmark. The odd thing
is that when I step through the exact same code in Debug I do not get
the error and the form loads properly.
I'm using Office 2003 SP3 on Vista SP1. This code worked before I
changed all my recordsets from DAO to ADO, so perhaps that is a clue?
Thank you if you can shed some light.
John
of a Form to match the bookmark of an ADO recordset:
Private Sub Form_Load()
Dim rst As ADODB.Recordset
Dim mctlFieldName As Control
Set rst = New ADODB.Recordset
Set mctlFieldName = Forms!frmCDs!cboFiledUnder
rst.Open Me.RecordSource, CurrentProject.Connection, _
adLockReadOnly, adCmdTable
Set rst = rst.Clone(adLockReadOnly)
rst.Find "ID=" & mctlFieldName.Value
Me.Bookmark = rst.Bookmark
When the code is run by opening the Form, I get an error:
Not a valid bookmark.
The error occurs on the line that starts Me.Bookmark. The odd thing
is that when I step through the exact same code in Debug I do not get
the error and the form loads properly.
I'm using Office 2003 SP3 on Vista SP1. This code worked before I
changed all my recordsets from DAO to ADO, so perhaps that is a clue?
Thank you if you can shed some light.
John