设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

VBA問題

[复制链接]
跳转到指定楼层
1#
发表于 2002-10-23 02:03:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
在穿體中有一標簽"label1",一命令按鈕"command1",請問,有什麼代碼,當按鈕下command1時將label1刪除,很見笑,我只能用"label1.visible=False"將其隱藏,故請高手幫忙.[em10][em08]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2002-10-23 02:57:00 | 只看该作者
下面的示例创建带有命令按钮的窗体,并且显示提示信息询问用户是否要删除这个命令按钮。如果用户单击“是”,则该命令按钮被删除。

Sub eleteCommandButton()
    Dim frm As Form, ctlNew As Control
    Dim strMsg As String, intResponse As Integer, _
         intDialog As Integer

    ' Create new form and get pointer to it.
    Set frm = CreateForm
    ' Create new command button.
    Set ctlNew = CreateControl(frm.Name, acCommandButton)
    ' Restore form.
    DoCmd.Restore
    ' Set caption.
    ctlNew.Caption = "New Command Button"
    ' Size control.
    ctlNew.SizeToFit
    ' Prompt user to delete control.
    strMsg = "About to delete " & ctlNew.Name &". Continue?"
    ' Define buttons to be displayed in dialog box.
    intDialog = vbYesNo + vbCritical + vbDefaultButton2
    intResponse = MsgBox(strMsg, intDialog)
    If intResponse = vbYes Then
        ' Delete control.
        DeleteControl frm.Name, ctlNew.Name
    End If
End Sub
3#
发表于 2002-10-23 02:58:00 | 只看该作者
DeleteControl 方法分别仅在窗体“设计”视图或报表“设计”视图中才可用。
4#
发表于 2002-10-23 03:46:00 | 只看该作者
呵呵,再提醒一句,删除了可就再也没有拉
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-31 19:26 , Processed in 0.087461 second(s), 27 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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