Results 1 to 5 of 5
  1. #1
    Join Date
    May 2011
    Location
    poway ca
    Posts
    38

    Unanswered: Unable to find file

    So what am i doing wrong?
    i know the directory c:\temp exists on my c drive
    However, when i execute the following vb code i get file not found after executing the 'set dbsdb ...' statement.
    dbsDb is defined as 'dim dbsDb As DAO.Database'
    do i need a reference for the DAO?
    and ideas? TIA

    Const strdbpc As String = "c:\temp"
    Const strPrsc As String = "new newsletter projects"

    '
    strDbp = strdbpc

    End Select


    Set dbsDb = OpenDatabase(strDbpc, Options:=False, ReadOnly:=True)
    Set rstProj = dbsDb.OpenRecordset("ia_remove.sh")
    Last edited by jtmedin; 05-09-11 at 13:54.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    is option explicit turned on
    it may be a typo but
    Set dbsDb = OpenDatabase(strDbp, Options:=False, ReadOnly:=True)
    probably should read
    Set dbsDb = OpenDatabase(strDbpc, Options:=False, ReadOnly:=True)
    assuming your earlier declaration Const strdbpc As String = "c:\temp" is true
    I'm also suspicious of the Options:=False, ReadOnly:=True) bit
    I'd expect that to be
    False, True)
    ie:- Set dbsDb = OpenDatabase(strDbpc, False, True)
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    And yes, for

    dim dbsDb As DAO.Database

    you do need the Microsoft DAO x.x Object Library, where x.x is the version number for the DAO Library for your particular version of Access. In Access 2003 it's Microsoft DAO 3.6 Object Library.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    May 2011
    Location
    poway ca
    Posts
    38
    Quote Originally Posted by Missinglinq View Post
    And yes, for

    dim dbsDb As DAO.Database

    you do need the Microsoft DAO x.x Object Library, where x.x is the version number for the DAO Library for your particular version of Access. In Access 2003 it's Microsoft DAO 3.6 Object Library.

    Linq ;0)>
    Using access 2007 & when i checked the DAO 3.6 got: conflicting module, names ... So what is the reference for access 2007? TIA

  5. #5
    Join Date
    May 2011
    Location
    poway ca
    Posts
    38
    Quote Originally Posted by healdem View Post
    is option explicit turned on

    no only: option compare database

    it may be a typo but
    Set dbsDb = OpenDatabase(strDbp, Options:=False, ReadOnly:=True)

    yes should be: strDbc

    probably should read
    Set dbsDb = OpenDatabase(strDbpc, Options:=False, ReadOnly:=True)
    assuming your earlier declaration Const strdbpc As String = "c:\temp" is true
    I'm also suspicious of the Options:=False, ReadOnly:=True) bit
    I'd expect that to be
    False, True)
    ie:- Set dbsDb = OpenDatabase(strDbpc, False, True)
    strDbpc should be: "c:\temp" & i believe the long forms i used are acceptable. It was some code i used in access 2000. Currently trying to learn about 2007.

Posting Permissions

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