|
-
Dec 10th, 2001, 11:51 AM
#1
Thread Starter
Bouncy Member
[Resolved] recordset does not support bookmarks
What types of recordsets DO support bookmarks then.
I've used them before, (bookmarks i mean) but i didn't set anything specific....
Last edited by darre1; Jan 31st, 2002 at 04:56 AM.
-
Dec 10th, 2001, 11:53 AM
#2
Frenzied Member
OpenKeyStatic..
or what ever the const is for that
-
Dec 10th, 2001, 11:57 AM
#3
Thread Starter
Bouncy Member
this is my code:
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
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.
Is it because im accessing a stored query?
-
Dec 10th, 2001, 12:09 PM
#4
Frenzied Member
why clone a recordset when you can use the first to do what ever youw ant?
-
Dec 10th, 2001, 12:18 PM
#5
Thread Starter
Bouncy Member
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...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|