Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Dim DAO.Database - problem

Discussion in 'Information Technology' started by Rolf Rosenquist, Jul 28, 2006.

  1. Rolf Rosenquist

    Rolf Rosenquist
    Expand Collapse
    Guest

    I have got an Access program that works in my computer. Some part of its
    code should be used in one of my own programs, so I copied and pasted those
    lines of code. But I get the error that the type is not defined. The line
    that doesn't work is: 'Dim db As DAO.Database'

    When in the sample program, I can define a second dim and get the DAO as
    well as Database from the combo, but these two aren't there when I write the
    code in my own program. Where and how should I define those two forst?

    / Rolf
     
  2. Loading...


  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    In the code window, choose References from the Tools menu.
    Check the box beside:
    Microsoft DAO 3.6 Library.

    All versions of Access have this library selected by default except Access
    2000 and 2002.

    More info:
    http://allenbrowne.com/ser-38.html

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Rolf Rosenquist" <rolf@nomail.com> wrote in message
    news:Ob4Qg%23krGHA.1604@TK2MSFTNGP05.phx.gbl...
    >I have got an Access program that works in my computer. Some part of its
    > code should be used in one of my own programs, so I copied and pasted
    > those
    > lines of code. But I get the error that the type is not defined. The line
    > that doesn't work is: 'Dim db As DAO.Database'
    >
    > When in the sample program, I can define a second dim and get the DAO as
    > well as Database from the combo, but these two aren't there when I write
    > the
    > code in my own program. Where and how should I define those two forst?
    >
    > / Rolf
     
  4. RoyVidar

    RoyVidar
    Expand Collapse
    Guest

    "Rolf Rosenquist" <rolf@nomail.com> wrote in message
    <Ob4Qg#krGHA.1604@TK2MSFTNGP05.phx.gbl>:
    > I have got an Access program that works in my computer. Some part of
    > its code should be used in one of my own programs, so I copied and
    > pasted those lines of code. But I get the error that the type is not
    > defined. The line that doesn't work is: 'Dim db As DAO.Database'
    >
    > When in the sample program, I can define a second dim and get the DAO
    > as well as Database from the combo, but these two aren't there when I
    > write the code in my own program. Where and how should I define those
    > two forst?
    >
    > / Rolf


    Ensure you have a reference to Microsoft DAO 3.6 Object Library (in VBE
    - Tools | References)

    --
    Roy-Vidar
     
  5. Rolf Rosenquist

    Rolf Rosenquist
    Expand Collapse
    Guest

    Thank you both Allen and Roy for your support! Now it works.
    / Rolf
     

Share This Page