Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Aug 2002
    Location
    Wichita, Kansas, USA
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Using Access 2007 with mdb file
    Open Access database which opens Switchboard at startup
    Getting an error when opening Switchboard:
    Run-time error '-2147418113(800ffff)': Method 'connection' of object '_Current Project' failed
    Debug puts to code line:
    Set con = Application.CurrentProject.Connection
    Hover mouse over this line of code and get:
    datasource object is already initialized

    The database is on a shared drive on our network and works fine for all but 1 person.

    Is there a way to make the 1 pc think the object is not initialized? Or what are other options? I've been searching for help on internet for several hours and not finding anything helpful.

    Below is the entire section of code:
    Private Sub FillOptions()
    ' Fill in the options for this switchboard page.

    ' The number of buttons on the form.
    Const conNumButtons = 8

    Dim con As Object
    Dim rs As Object
    Dim stSql As String
    Dim intOption As Integer

    ' Set the focus to the first button on the form,
    ' and then hide all of the buttons on the form
    ' but the first. You can't hide the field with the focus.
    Me![Option1].SetFocus
    For intOption = 2 To conNumButtons
    Me("Option" & intOption).Visible = False
    Me("OptionLabel" & intOption).Visible = False
    Next intOption

    ' Open the table of Switchboard Items, and find
    ' the first item for this Switchboard Page.
    Set con = Application.CurrentProject.Connection
    stSql = "SELECT * FROM [Switchboard Items]"
    stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
    stSql = stSql & " ORDER BY [ItemNumber];"
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open stSql, con, 1 ' 1 = adOpenKeyset

    ' If there are no options for this Switchboard Page,
    ' display a message. Otherwise, fill the page with the items.
    If (rs.EOF) Then
    Me![OptionLabel1].Caption = "There are no items for this switchboard page"
    Else
    While (Not (rs.EOF))
    Me("Option" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
    rs.MoveNext
    Wend
    End If

    ' Close the recordset and the database.
    rs.Close
    Set rs = Nothing
    Set con = Nothing

    End Sub

    Thanks so much!!!

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    What OS is the Office 2007 PC running, Win7, Vista, or XP? Are the workstations that work OK running the same configuration as the one that fails. This is a problem that has been encountered by others - see this thread for example, though I don't know that it was ever solved. Also, what is the back-end database that the connect string is trying to open - another Access database, tables in this database, or an ODBC data source?
    Wendell

Posting Permissions

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