给你一个简单的例子,在工具/添加过程中,添加名字为STRSQL的属性,然后加入下列代码,这个FORM就有了一个新属性STRSQL,在其他的窗体也可以写:FRMHELP.STRSQL="SELECT ..."。 GOOD LUCK! ************************************* Option Explicit Public dong As stringPublic Property Get strsql() As string strsql = dong End PropertyPublic Property Let strsql(ByVal vNewValue As strsql) dong = vNewValue End PropertyPrivate Sub Command1_Click() Me.strsql = "select ..." End SubPrivate Sub Command2_Click() Me.Caption = Me.strsql End Sub
我可以給frmhelp 加几个属性馬?我只想在frmhelp中執行傳過来的Sql語句
謝謝
1.添加一个public变量
2.添加一个模块变量,再添加相应的属性函数(在tools\add procedure菜单中)
GOOD LUCK!
*************************************
Option Explicit
Public dong As stringPublic Property Get strsql() As string
strsql = dong
End PropertyPublic Property Let strsql(ByVal vNewValue As strsql)
dong = vNewValue
End PropertyPrivate Sub Command1_Click()
Me.strsql = "select ..."
End SubPrivate Sub Command2_Click()
Me.Caption = Me.strsql
End Sub