Minty
AWF VIP
- Local time
 - Today, 10:39
 
- Joined
 - Jul 26, 2013
 
- Messages
 - 10,702
 
Hi All,
I very rarely use ADO, but am playing with using a disconnected ADO recordset to populate a imitation "tree-view" sub-form (caused by a corporate switch to 64 bit Access, and 2016 version).
Currently the form works but relies on a temporary local table currently - which means if I want multiple instances of the form open I have to create multiple temp tables, so I thought "why not use a disconnected recordset" instead.
So after battling with it for most of the afternoon, I'm possibly coming to the conclusion that I can't do a couple of things.
a) Update a ADO recordset row with non ascii characters (I'm trying to change a ► at the start to a ● if there is no child item to indicate no expansion is possible) using
	
	
	
		
The full code of the bit I'm struggling with is;
	
	
	
		
The error is:
Multiple-step operation generated errors .Check each status value.
If I can get past this niggling issue - I have made the assumption that I can add and delete rows from this recordset, before discarding it when the form is unloaded, am I correct?
I presume I can't achieve this with a DOA recordset, as it can't be disconnected. The only other route would be a Array, but that seems really over the top.
And I hate array's.
 I very rarely use ADO, but am playing with using a disconnected ADO recordset to populate a imitation "tree-view" sub-form (caused by a corporate switch to 64 bit Access, and 2016 version).
Currently the form works but relies on a temporary local table currently - which means if I want multiple instances of the form open I have to create multiple temp tables, so I thought "why not use a disconnected recordset" instead.
So after battling with it for most of the afternoon, I'm possibly coming to the conclusion that I can't do a couple of things.
a) Update a ADO recordset row with non ascii characters (I'm trying to change a ► at the start to a ● if there is no child item to indicate no expansion is possible) using
		Code:
	
	
	 .Fields("NodeCaption") = Replace(.Fields("NodeCaption"), ChrW(9658), ChrW(9679) & " ")
	The full code of the bit I'm struggling with is;
		Code:
	
	
	Set rsTree = New ADODB.Recordset
        Set cn = CurrentProject.Connection
        With rsTree
            Set .ActiveConnection = cn
            .Source = sSql                      
            .LockType = adLockOptimistic
            .CursorType = adOpenKeyset
            .CursorLocation = adUseClient
            .Open
        End With
        Set cn = Nothing
        'qd.Execute dbFailOnError
        '        qd.Close
                
        'Mark records without children with a small black circle eg: Replace([NodeCaption],ChrW(9658),ChrW(9679) & " ")
        'Add the trailing space to get the items to line up
        'Set IsExpanded and Is Group to False
          
        With rsTree
            .MoveLast
            .MoveFirst
          '  Debug.Print .RecordCount
            While Not .EOF
                If .Fields("ChildrenCount") = 0 Then
                     Debug.Print "RS "; .Fields!NodeCaption
                    [COLOR="Red"].Fields("NodeCaption") = Replace(.Fields("NodeCaption"), ChrW(9658), ChrW(9679) & " ")[/COLOR]     'This line fails 
                    .Fields("IsExpanded") = 0
                    .Fields("IsGroup") = 0
                    .Update
                End If
                .MoveNext
            Wend
        End With
	The error is:
Multiple-step operation generated errors .Check each status value.
If I can get past this niggling issue - I have made the assumption that I can add and delete rows from this recordset, before discarding it when the form is unloaded, am I correct?
I presume I can't achieve this with a DOA recordset, as it can't be disconnected. The only other route would be a Array, but that seems really over the top.
And I hate array's.