Help with Database Object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • scottallenmccullough@gmail.com

    #1

    Help with Database Object

    I've recently returned to Access programming, having last worked
    extensively in Access 97. I'm now using Access 2002. I am trying to
    reuse some old code (from A97 days) and am having some troubles. The
    following snippet no longer works in A2002.

    Line 01 Dim rst As Recordset
    Line 02 Dim db As Database
    Line 03 set db = CurrentDb()
    Line 04 set rst = db.OpenRecordse t(TableName", dbOpenDynaset)

    The code is returning a 'Run-time Error 13, Type Mismatch' Error on
    line 04.

    Any help would be greatly appreciated.

    Scott
    P.S. I did turn on DAO 3.6 in Tools|Reference s

  • Stefan Kowalski

    #2
    Re: Help with Database Object

    <scottallenmccu llough@gmail.co m> wrote in message
    news:1108398126 .745957.287620@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    > I've recently returned to Access programming, having last worked
    > extensively in Access 97. I'm now using Access 2002. I am trying to
    > reuse some old code (from A97 days) and am having some troubles. The
    > following snippet no longer works in A2002.
    >
    > Line 01 Dim rst As Recordset
    > Line 02 Dim db As Database
    > Line 03 set db = CurrentDb()
    > Line 04 set rst = db.OpenRecordse t(TableName", dbOpenDynaset)
    >
    > The code is returning a 'Run-time Error 13, Type Mismatch' Error on
    > line 04.
    >
    > Any help would be greatly appreciated.
    >
    > Scott
    > P.S. I did turn on DAO 3.6 in Tools|Reference s[/color]


    You could also remove references which you are not using, e.g. ActiveX Data
    Objects so you are not referencing more than one object model which has the
    recordset object. However, you may be best just doing a find and replace
    making sure you replace "As Recordset" with "As DAO.Recordset" and "As
    Database" with "As DAO.Database". Then make sure the thing compiles.
    By the way, is this a typo? db.OpenRecordse t(TableName", dbOpenDynaset)
    Should it be TableName with no quotes?


    Comment

    • pietlinden@hotmail.com

      #3
      Re: Help with Database Object


      scottallenmccul lough@gmail.com wrote:[color=blue]
      > I've recently returned to Access programming, having last worked
      > extensively in Access 97. I'm now using Access 2002. I am trying to
      > reuse some old code (from A97 days) and am having some troubles. The
      > following snippet no longer works in A2002.
      >
      > Line 01 Dim rst As Recordset
      > Line 02 Dim db As Database
      > Line 03 set db = CurrentDb()
      > Line 04 set rst = db.OpenRecordse t(TableName", dbOpenDynaset)
      >
      > The code is returning a 'Run-time Error 13, Type Mismatch' Error on
      > line 04.
      >
      > Any help would be greatly appreciated.
      >
      > Scott
      > P.S. I did turn on DAO 3.6 in Tools|Reference s[/color]

      Well, you're part of the way there. You have to either:
      1. move the DAO 3.6 library ABOVE the ADO library, OR
      2. disambiguate references. i.e. dim rst As DAO.Recordset
      3. deselect the ADO library.

      Comment

      • jimfortune@compumarc.com

        #4
        Re: Help with Database Object

        scottallenmccul lough@gmail.com wrote:[color=blue]
        > I've recently returned to Access programming, having last worked
        > extensively in Access 97. I'm now using Access 2002. I am trying to
        > reuse some old code (from A97 days) and am having some troubles. The
        > following snippet no longer works in A2002.
        >
        > Line 01 Dim rst As Recordset
        > Line 02 Dim db As Database
        > Line 03 set db = CurrentDb()
        > Line 04 set rst = db.OpenRecordse t(TableName", dbOpenDynaset)
        >
        > The code is returning a 'Run-time Error 13, Type Mismatch' Error on
        > line 04.
        >
        > Any help would be greatly appreciated.
        >
        > Scott
        > P.S. I did turn on DAO 3.6 in Tools|Reference s[/color]

        Did you cut and paste or import the code from A97? Whenever I convert
        an A97 database to a later version by opening it in the newer version,
        I never have to worry about the references. I don't even have to put
        DAO.Recordset.

        James A. Fortune

        Comment

        Working...