Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    London
    Posts
    46

    Unhappy Unanswered: Run-time error 13

    Hiya

    I'm confused at this one.. annoying the heck out of me. I'm trying to get a bit of code to update an active x listview from a tree view. No matter what I do (and I've even borrowed some code) it won't open my query.. just keeps saying "Runtime-error" 13 Type mismatch. It highlights the "Set rs = db.OpenRecordset("qrytasks")" line everytime.

    it even does it if I change the recordsource to something totally different.. same error

    I've stripped it down to find the problem (i.e. just tried to get the query to populate the listview) but still getting the same problem

    Can anyone suggest anything wrong with this code: Thanks in advance!

    Dim db As Database, rs As Recordset
    Dim intI As Integer, intTotalRecords As Integer
    Dim colHeader As ColumnHeader
    Dim lstItem As ListItem

    Set db = CurrentDb
    Set rs = db.OpenRecordset("qrytasks")

    Forms!frmMainMenu!ListView.SmallIcons = ImageList1.Object
    Forms!frmMainMenu!ListView.View = lvwReport

    ' Set up column headers
    With Forms!frmMainMenu!ListView.ColumnHeaders
    .Add , , "Blahhhh", 2880
    .Add , , "dee", 1440
    .Add , , "blah", 1000
    .Add , , "blah", 1000
    End With

    ' Add items and subitems to list control.
    rs.MoveFirst
    While Not rs.EOF
    Set lstItem = Forms!frmMainMenu!ListView.ListItems.Add()

    lstItem.Text = rs!OBS_L1
    'lstItem.SmallIcon = rs!Country
    'lstItem.Icon = rs!Country

    rs.MoveNext
    Wend
    rs.Close

  2. #2
    Join Date
    Feb 2004
    Location
    London
    Posts
    46
    any ideas anyone?

  3. #3
    Join Date
    Jan 2004
    Location
    Lancashire, UK
    Posts
    33
    Try declaring your recordset as follows:

    Dim rs As DAO.Recordset

    You generally get this error when you have a reference to ADO and DAO in your MDB.

  4. #4
    Join Date
    Feb 2004
    Location
    London
    Posts
    46
    cheers Minty you're a star, works fine now (how stupid do I feel)

    much thanks for your help!!

  5. #5
    Join Date
    Jan 2004
    Location
    Lancashire, UK
    Posts
    33
    [QUOTE=Andyp]cheers Minty you're a star, works fine now (how stupid do I feel) QUOTE]

    No comment I have to admit, I used to remove the ado reference as I had no idea what it was.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •