Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    recordsetCLone (XP/2K)

    I have the following part of a code:
    Dim rstClone As Recordset
    Dim arrRecCount(1 To 5) As Integer

    'set order of records and get # of records for each cemetery
    Me.OrderBy = "intCemetary"
    Me.OrderByOn = True
    DoCmd.GoToRecord , , acFirst
    Set rstClone = Me.RecordsetClone

    Do Until rstClone.EOF
    arrRecCount(rstClone.Fields("intCemetary")) = arrRecCount(rstClone.Fields("intCemetary")) + 1
    rstClone.MoveNext
    Loop


    When I run this it gives me the following error:
    Error 13 type mismatch.

    The code compiles correctly, and I have the reference to both ADO 2.1 and DAO 3.6 set.
    Any ideas?
    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: recordsetCLone (XP/2K)

    It is always useful to mention what is highlighted when you get this error. Now we have to guess which line might be the culprit.

    Does it help if you make the declaration explicit?

    Dim rstClone As DAO.Recordset

    or if you use late binding?

    Dim rstClone As Object

    If neither works, try using rstClone.Fields("intCemetary").Value instead of just rstClone.Fields("intCemetary").

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: recordsetCLone (XP/2K)

    Sorry.
    Changing it to DAO.Recordset fixed it.

Posting Permissions

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