Runtime error 3265 - im using Access 2003 and VB6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DGNinja12
    New Member
    • Mar 2008
    • 1

    Runtime error 3265 - im using Access 2003 and VB6

    I get this error when i run, i cant figure out what is wrong
    Can some one please help me?

    Run-time error '3265': Item cannot be found in the collection corresponding to the requested name or ordinal.

    Below is my code


    Private Sub Form_Load()

    medcon.Connecti onString = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=M:\Herba l_Medicine_Data base.mdb;Persis t Security Info=False"
    medcon.Open
    medrs.Open "Select * from MedDetails ", medcon, adOpenDynamic, adLockOptimisti c

    DISP
    LockNow

    End Sub

    Public Sub DISP()
    'coding to display record in textbox
    If Not (medrs.EOF = True Or medrs.BOF = True) Then
    txtRedgNum.Text = medrs.Fields.It em("RedgNum")
    txtComplnts.Tex t = medrs.Fields.It em("Complaints" ) ' on debug this is highlighted txtIllns.Text = medrs.Fields.It em("Illness")
    txtPstIllns.Tex t = medrs.Fields.It em("PastIllness ")
    txtDrgPresc.Tex t = medrs.Fields.It em("DrugPrescri bed")
    End If

    End Sub
  • VBWheaties
    New Member
    • Feb 2008
    • 145

    #2
    Item not found in this collection means the column does not exist.
    Check your spelling. Lower case L's are sometimes confused with upper case i's.
    If you still cant find it, run a loop of the items in the collection to see what they are named. Something like this:

    Code:
    Dim I as Integer
    
    For I = 0 To MyRecordset.Items.Count - 1
    
       Debug.Print "Field name is " & MyRecordset.Items(I).ColumnName
    
    Next I
    Another idea is to explicitly set the field name in the select statement: SELECT Field1, Field2 FROM DataTable. instead of SELECT * because you'll only use those fields you need instead of returning a huge collection of columns you dont need.

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      Check field "Complaints " is present in Table MedDetails
      (In the connected database)
      Check the Spelling also..


      Regards
      Veena

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Just check the spelling of the field in the database table.

        Else use index in recordset in place on name of the fields.

        Comment

        Working...