PDA

View Full Version : Still @#E$% ACCESS ERROR



mud2
03-18-2006, 09:31 PM
I have used the ACCESS 'Switchboard" for 2 years. Suddenly(?) perhaps, after loading Norton's "SystemWorks" when I click on the Switchboard'f form button ( to open it up), I get the eror message:
"Method of connection of object 'currentproject' failed." The debug option highlited the line:
Set con = Application.CurrentProject.Connection

It's shown below in a snippet of the programming.

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.

'*************************************************************************
'* *
'* On 2/25/06, after using this many times, I now get an error message. *
'* The debug/help suggested inserting the following: *
'* On Error Resume Next *
'* Now when I run this, (above) The Switchboard says it is empty! *
'*************************************************************************

' *********************************************************
' * The DEBUG OPtion Highlights the following line: *
' * 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

I just tried a non-switchboard project...using ADO...and get the same message!

HELP!!!

XLGibbs
03-19-2006, 08:09 AM
Are you sure the current connection is established?

Maybe if you hardcoded the connection string instead to avoid the issue..