D 
		
				
			
		Deleted member 73419
Guest
I have the following code which, in simple terms, puts three RecordSets in to a dictionary (which allows me to use named RecordSets) where a function  is called (
	
	
	
		
I don't want any copies of the RecordSets so am passing the dictionary across ByRef to ensure any action taken is on the actual data.
The error I am getting is
		
		
	
	
		
	
on this line
This is clearly a simplified overview of the issue as I'm yet to determine the criteria for which fields to delete but the problem is really why I cannot delete a field and not which one!!
Does anyone know how to fix this?
Thanks
 Private Function RMDupes(ByRef RSS As Dictionary) and following that some processing takes place which then decides whether certain fields are required going forwards.  If they are not I want to get delete the field in question:
		Code:
	
	
	Private Sub Command143_Click()
    
    Dim DB As DAO.Database
    Dim RS As DAO.Recordset
    Dim RSS As New Dictionary
    Dim Comp As New Dictionary
    Dim SQL As String
    Dim SQLB As String
    Dim ComparisonKey As Variant
    Set DB = CurrentDb
    
    SQLB = "SELECT [PN],[SU],[DE] FROM tbl WHERE ([PN] LIKE '')"
    
    Call Comp.Add("10001", "C1")
    Call Comp.Add("10002", "C2")
    Call Comp.Add("10003", "C3")
    
    For Each ComparisonKey In Comp.Keys
        SQL = Replace(SQLB, "''", "'" & ComparisonKey & "'", , , vbTextCompare)
        Set RS = DB.OpenRecordset(SQL)
        Call RSS.Add(Comp(ComparisonKey), RS)
        Set RS = Nothing
    Next
    
    Call RMDupes(RSS)
    
    '...follow on processing
End Sub
Private Function RMDupes(ByRef RSS As Dictionary)
    
    '...determine which fields need removing
    
    RSS.Items(1).Fields("SU").Delete 'HERE IS THE PROBLEM!!
    
 End Function
	I don't want any copies of the RecordSets so am passing the dictionary across ByRef to ensure any action taken is on the actual data.
The error I am getting is
on this line
RSS.Items(1).Fields("SU").DeleteThis is clearly a simplified overview of the issue as I'm yet to determine the criteria for which fields to delete but the problem is really why I cannot delete a field and not which one!!
Does anyone know how to fix this?
Thanks