设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1912|回复: 7
打印 上一主题 下一主题

[Access本身] 关于切换面板的问题

[复制链接]
跳转到指定楼层
1#
发表于 2005-8-7 23:12:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我是新手,请不要见笑。

  为什么我在装有Office2000的电脑上通过“切换面板管理器”设计好了切换面板,拿到另一台装有OfficeXP的电脑上却不能打开切换面板?请高手指点,非常感谢!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2005-8-7 23:15:00 | 只看该作者
文件发上来看看
3#
发表于 2005-8-7 23:15:00 | 只看该作者
怎么个不能法呢?有什么提示吗?
4#
 楼主| 发表于 2005-8-8 01:16:00 | 只看该作者
版主,你好!我输入用户名和密码后就进入如下页面,第一行为黄色,中间“.Connection”为兰色底,也没有提示,是不是“.Connection”这有问题,我不知是什么意思,请指点,谢谢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 = "此切换面板页上无项目。"

    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 = NothingEnd Sub
5#
 楼主| 发表于 2005-8-8 17:44:00 | 只看该作者
没人帮我吗?
6#
发表于 2005-8-8 18:32:00 | 只看该作者
大概是ADO没有引用吧
7#
 楼主| 发表于 2005-8-8 22:58:00 | 只看该作者
请问如何解决?
8#
发表于 2005-8-8 23:02:00 | 只看该作者
以下是引用tzjj在2005-8-7 17:16:00的发言:

版主,你好!

我输入用户名和密码后就进入如下页面,第一行为黄色,中间“.Connection”为兰色底,也没有提示,是不是“.Connection”这有问题,我不知是什么意思,请指点,谢谢

Private Sub FillOptions()

' Fill in the options for this switchboard page.

    ' The number of buttons on the form.

    Const conNumButtons = 8

   

    Dim con As ADODB.Connection

    Dim rs As ADODB.Recordset

    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 = "此切换面板页上无项目。"

    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



红色部分代码改了试试。

[此贴子已经被作者于2005-8-8 15:02:32编辑过]

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-9-22 09:52 , Processed in 0.087878 second(s), 32 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表