What types of recordsets DO support bookmarks then.
I've used them before, (bookmarks i mean) but i didn't set anything specific....
Printable View
What types of recordsets DO support bookmarks then.
I've used them before, (bookmarks i mean) but i didn't set anything specific....
OpenKeyStatic..
or what ever the const is for that
this is my code:
I know that to clone a recordset it has to support bookmarks, but i've got my recordset with dynamic access anyway! Other recordsets work fine, just this one.Code:Private Sub SortOutstandingList(strByField As String, strOrder As String)
'Redisplays the listbox
On Error GoTo ErrorHandler
Dim rst As Recordset
'Define the recordset
If rstOutstanding.State = adStateOpen Then rstOutstanding.Close
rstOutstanding.Open "SELECT * FROM qrylbxLogsOutstanding " _
& "ORDER BY " & strByField & " " & strOrder & ", numPriority ASC;", db, _
adOpenDynamic, adLockPessimistic
'Clone the recordset to prevent the MoveComplete event from firing
***NEXT LINES GENERATES THE ERROR***
Set rst = rstOutstanding.Clone
'Clear then Populate list
lbxOutstanding.Clear
While Not rst.EOF
lbxOutstanding.AddItem rst!ListString
lbxOutstanding.ItemData(IIf(lbxOutstanding.NewIndex = -1, 0, lbxOutstanding.NewIndex)) = CInt(rst!ID)
rst.MoveNext
Wend
rst.Close
'Display first record in list
If lbxOutstanding.ListCount >= 1 Then
lbxOutstanding.ListIndex = 0
End If
CleanUp:
Set rst = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Description, , Err.Number
Resume CleanUp
End Sub
Is it because im accessing a stored query?
why clone a recordset when you can use the first to do what ever youw ant?
the original is used to populate a listbox with a few fields form each record.
I then have code in the listbox's on_Click event to navigate the recordset to the record that was just clicked in the list.
I then have code in the recordset's on_move event that fills the textboxes etc on screen, to display the values of the current record.
NOTE: This method of record selecting is bloody fast.
I also have sort buttons for the listboxes, which is where the code that i pasted comes in.
The problem is, that if i dont use a clone recordset then the On_Move event will fire each time i add a record to the listbox (think about it)
At the moment i'm just declaring 2 recordsets which are identical, but in all my other forms etc and other apps i can create clones and get round the OnMove event problem easily...