Compile error message

colinmunnelly

Registered User.
Local time
Today, 11:29
Joined
Feb 26, 2002
Messages
89
Just converted data from 2000 to 97 and received following message. Compile error cant find object

Private Sub FillOptions()
' Fill in the options for this switchboard page.

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

Dim dbs As Database

It highlights the dbs As Database line
 
It's Db I think, although it shouldn't make any difference should it?

Col


[This message has been edited by ColinEssex (edited 05-27-2002).]
 
Changed the refrences to db but nope still no good
 
The full code is this if anyone can help and save me pulling whats left of my hair out!!!

Private Sub FillOptions()
' Fill in the options for this switchboard page.

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

Dim dbs As Database
Dim rst As Recordset
Dim strSQL 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 dbs = CurrentDb()
strSQL = "SELECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
strSQL = strSQL & " ORDER BY [ItemNumber];"
Set rst = dbs.OpenRecordset(strSQL)

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

' Close the recordset and the database.
rst.Close
dbs.Close

End Sub
 
In the Code screen, click on Tools - References and Make sure that
a) Microsoft DAO 3.xx is ticked
b) That this is higher than Active X Objects.
HTH
 
tried it. Its saying that 3.5 is not compatible with this version of access.
 

Users who are viewing this thread

Back
Top Bottom