rs1.Open "select cname, desg, division,dept,ministry From data_detail where country='" & cmbcontry.Text & "' GROUP BY cname, desg, division,dept,ministry HAVING Count(*)>1 ", con, adOpenStatic, adLockOptimistic, adOpenKeyset
Item cannot be found in the collection corresponding to the requested name or ordinal
If rs1.RecordCount > 0 Then rs1.MoveFirst While (rs1.EOF = False) trec = trec + 1 rs1.MoveNext Wend End If trec = 6 Mf1.Rows = rs1.RecordCount + 1 Mf1.Cols = 6 Mf1.Row = 0 Mf1.Col = 1 Mf1.Text = "CName" Mf1.Row = 0 Mf1.Col = 2 Mf1.Text = "Designation" Mf1.Row = 0 Mf1.Col = 3 Mf1.Text = "Division" Mf1.Row = 0 Mf1.Col = 4 Mf1.Text = "Department" Mf1.Row = 0 Mf1.Col = 5 Mf1.Text = "Ministry" For i = 0 To rs1.RecordCount - 1 rs1.MoveFirst rs1.Move i Mf1.Row = i + 1 'For rl = 1 To rs1.RecordCount ' For dup = 2 To rs1.RecordCount 'If (r1! = dup) Then Mf1.Col = 1 Mf1.Text = rs1.Fields(9)//where i am getting this error Mf1.Col = 2 Mf1.Text = rs1.Fields(10) Mf1.Col = 3 Mf1.Text = rs1.Fields(11) Mf1.Col = 4 Mf1.Text = rs1.Fields(12) Mf1.Col = 5 Mf1.Text = rs1.Fields(13) rs1.MoveNext Next For i = 1 To Mf1.Rows For j = 0 To Mf1.Cols - 1 Mf1.Row = i - 1 Mf1.Col = j Next Next
From link[^]:Item cannot be found in the collection corresponding to the requested name or ordinal ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal. This like the error above is a recordset error. You have tried requesting a field from the recordset that does not exist. Check when you are reading in the field from the recordset into a variable or to display in a web page that you have spelt the field name correctly and that the field exists in the database.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)