This is what i have so far:
I have no idea which way to go next, basically i have a field called "LOC_ID" that has a bunch of duplicates in it. I need to select one of each variation using the "LOC_ID" field while still keeping all the other fields in the record.Code:CntTblSQL = "SELECT sorted.LOC_ID, Count(sorted.LOC_ID) AS CountOfLOC_ID INTO CntTable FROM sorted GROUP BY sorted.LOC_ID ORDER BY sorted.LOC_ID;" DoCmd.SetWarnings False DoCmd.RunSQL CntTblSQL DoCmd.SetWarnings True pass1 = "SELECT * FROM CntTable" dataconnect.Open pass1, CurrentProject.Connection, adOpenDynamic, adLockOptimistic With dataconnect Do While Not dataconnect.EOF strLocId = dataconnect.Fields("LOC_ID").Value Count = dataconnect.Fields("CountofLOC_ID").Value MsgBox strLocId MsgBox Count .MoveNext Loop End With dataconnect.Close End Sub
any help would be much appreciated!


Reply With Quote

