Results 1 to 3 of 3

"Can't find project or library" in Windows10+Access2003. Not in XP+Access2000. Write new code?

  1. #1
    Starter-4-10 is offline Novice
    Windows 10 Access 2003
    Join Date
    Dec 2016
    Posts
    27

    "Can't find project or library" in Windows10+Access2003. Not in XP+Access2000. Write new code?

    Autoexec RunCode GetDBPath() stops with the word Mid (in red below) highlighted. Curable by unticking Microsoft Office Web Components in References - but after that, database can't find the named photo folders. Yet, in XP, that unticking isn't needed, and doing it doesn't seem have any affect - it continues to run fine. Might re-written code solve this? Or are the photo folders probably "lost" for some other reason?

    Option Compare Database
    Option Explicit


    Public strDBPath As String
    Public strPhotoDir1 As String
    Public strPhotoDir2 As String
    Public strPhotoDir3 As String
    Public strPhotoDir4 As String


    Public strGraphicDir As String


    Public intFormHeight As Integer
    Public intFormWidth As Integer


    Function GetDBPath()

    Dim MyDB As Database
    Dim intTitleLength, intDBLength, intCount As Integer

    Set MyDB = CurrentDb()

    intDBLength = Len(MyDB.Name)

    For intCount = intDBLength To 1 Step -1
    If Mid(MyDB.Name, intCount, 1) = "" Then
    Exit For
    End If
    Next

    intTitleLength = intDBLength - intCount

    strDBPath = Left(MyDB.Name, Len(MyDB.Name) - intTitleLength)
    strPhotoDir1 = strDBPath & "dbase photos1"
    strPhotoDir2 = strDBPath & "dbase photos2"
    strPhotoDir3 = strDBPath & "dbase photos3"
    strPhotoDir4 = strDBPath & "dbase photos4" ' line added DB
    strGraphicDir = strDBPath & "dbase graphics"
    'MsgBox "Autogenerated paths:@Database: " & strDBPath & "@Photos: " & strPhotoDir4

    Debug.Print "Exit Basinitialise"


    End Function

  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,450
    What is the error number - 2950? If so, look at the references for any that are marked as missing and rectify that. If none are missing, select any reference, check it, close Access, reopen and uncheck that reference. This is supposed to enforce a relinking of references. There is a references bug - not sure if it only applies to W10.

    BTW, re: Dim intTitleLength, intDBLength, intCount As Integer
    the first two are variants because their data types are not declared. The last type declaration does not propagate to the ones that come before it.
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    seems to me attempting to compare "" to a variable length string could be problematic. On the other hand I would have thought that to be problematic way back in 2000 also. But I've seen other examples of code being more 'liberal' in the past whereby it is tightened up today and less forgiving. So I could be wrong on this point.

    not directly related is of course the topic of ~2000 era code and 2016 era libraries; there is definitely a penalty that develops in staying too far behind in generations and my recommendation is never more than 10 years.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 07-07-2016, 12:22 PM
  2. Replies: 1
    Last Post: 06-22-2016, 06:45 AM
  3. Replies: 0
    Last Post: 11-04-2015, 09:54 PM
  4. Replies: 22
    Last Post: 10-10-2013, 12:47 PM
  5. ambigious "can't find project or libray" msg
    By markjkubicki in forum Programming
    Replies: 3
    Last Post: 09-06-2013, 04:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums