Results 1 to 2 of 2

Thread: Problem On Load

  1. #1
    Join Date
    Mar 2003
    Posts
    225

    Unanswered: Problem On Load

    right heres my problems.

    i am trying to take a database from the network drive and get it to function on my laptop as a stand alone, puerly as a demonstrator.

    the current drive path is \\Tech02\oeedata\

    the current version is in access 97 so i have converted it over so that i can use access 2000 on my laptop.

    i have posted about the path change before and i have used the following to hopefully rectify the location issues:

    Code:
    Function Reconnect()
    Dim ref As Reference
    Dim db As Database, source As String, path As String
    Dim dbsource As String, i As Integer, j As Integer
    Set db = DBEngine.Workspaces(0).Databases(0)
    
    For i = Len(db.Name) To 1 Step -1
    If Mid(db.Name, i, 1) = Chr(92) Then
    path = Mid(db.Name, 1, i)
    'MsgBox (path)
    Exit For
    End If
    Next
    
    For i = 0 To db.TableDefs.Count - 1
    If db.TableDefs(i).Connect <> " " Then
    source = Mid(db.TableDefs(i).Connect, 11)
    'Debug.Print source
    For j = Len(source) To 1 Step -1
    If Mid(source, j, 1) = Chr(92) Then
    dbsource = Mid(source, j + 1, Len(source))
    source = Mid(source, 1, j)
    If source <> path Then
    db.TableDefs(i).Connect = ";Database=" + path + dbsource
    db.TableDefs(i).RefreshLink
    'Debug.Print ";Database=" + path + dbsource
    End If
    Exit For
    End If
    Next
    End If
    Next
    
    End Function

    and have placed this in a module called

    Reconnect


    i have then placed in the first form that loads, proterties on load =reconnect() to call the function

    yet when i open the database it comes up with a window displaying te following:


    Quote:
    --------------------------------------------------------------------------------

    the expression on load you entered as the event property setting produced the following error:
    the expression you entered has a function name that Microsoft Access can't find.
    *the expression may not result in the name of a macro, the name of a user defined function or event procedure.
    *there may have been an error evaluating the function, event or macro


    --------------------------------------------------------------------------------



    now to be honest i aint got a clue what that meant but my DB just don't like it...please help

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    do you have the DAO3.6 library referenced?

    izy
    currently using SS 2008R2

Posting Permissions

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