本文介绍了以编程方式设置启动表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 如何在数据库打开时以编程方式设置启动表单? 谢谢! SteveHow can I programatically set the startup form when the database opens?Thanks!Steve推荐答案 1)感谢您对我的分类问题的帮助 2)如果在开放赛事中有一个不打算用 打开的启动表单怎么样?标准可以基于 网络用户名,是否可以与后端建立连接(使用简单的记录集打开测试等),等等,全部在 空气代码选择声明之前运行。 dim strOpenForm as string select case< ;一些标准> 案例1 stropenform =" form1" 案例2 stropenform =" form2" case else stropenform =" whatever" 结束选择 取消=真''取消此表单的打开(或隐藏它以存储值) docmd.openform stropenForm - Tim http://www.ucs.mun.ca/~tmarshal/ ^ o< / #)打嗝,打嗝,打嗝? - Quaker Jake / ^^Whatcha doin? - 同上TIM-MAY !! - 我1) Thanks for your help on my sorting question2) How about have a start up form that''s not intended to be opened withthe following in the on open event. the criteria could be based on thenetwork user name, whether a connection to the backend is able to bemade (test with a simple recordset open), etc, etc, all run before theair code select statement below.dim strOpenForm as stringselect case <some criteria>case 1stropenform = "form1"case 2stropenform = "form2"case elsestropenform = "whatever"end selectcancel = true ''cancel opening of this form (or hide it for value storage)docmd.openform stropenForm--Tim http://www.ucs.mun.ca/~tmarshal/^o</#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me 2)如果有一个启动表单,打算不打开以下内容事件。标准可以基于网络用户名,是否能够与后端建立连接(用简单的记录集打开测试等)等,都在空中代码之前运行选择下面的语句。 dim strOpenForm as string select case< some criteria> case 1 stropenform = form1 案例2 stropenform =" form2" 案例 stropenform ="无论什么 结束选择 取消=真''取消此表单的打开(或隐藏它以存储值) docmd.openform stropenForm - Tim http:/ /www.ucs.mun.ca/~tmarshal/ ^ o< /#)" Burp-beep,burp-beep,burp-beep?" - Quaker Jake / ^^Whatcha doin? - 同上TIM-MAY !! - 我 1) Thanks for your help on my sorting question 2) How about have a start up form that''s not intended to be opened with the following in the on open event. the criteria could be based on the network user name, whether a connection to the backend is able to be made (test with a simple recordset open), etc, etc, all run before the air code select statement below. dim strOpenForm as string select case <some criteria> case 1 stropenform = "form1" case 2 stropenform = "form2" case else stropenform = "whatever" end select cancel = true ''cancel opening of this form (or hide it for value storage) docmd.openform stropenForm -- Tim http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me ChangeProperty" StartupForm",dbText," YourFormName" ; 私有函数ChangeProperty(strPropName As String,varPropType As Variant,varPropValue As Variant)As Boolean Dim db As Database,prp As Property Const conPropNotFoundError = 3270 On Error GoTo Change_Err 设置db = CurrentDb db.Properties(strPropName)= varPropValue ChangeProperty = True 退出函数 Change_Err: 如果Err = conPropNotFoundError那么 设置prp = db.CreateProperty(strPropName,varPropType,varPropValue) db.Properties.Append prp 继续下一步 否则 ChangeProperty = False 退出函数 结束如果 结束函数 如果该属性不存在然而,它将被创建。 Arno RChangeProperty "StartupForm", dbText, "YourFormName"Private Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As BooleanDim db As Database, prp As PropertyConst conPropNotFoundError = 3270On Error GoTo Change_ErrSet db = CurrentDbdb.Properties(strPropName) = varPropValueChangeProperty = TrueExit FunctionChange_Err:If Err = conPropNotFoundError ThenSet prp = db.CreateProperty(strPropName, varPropType, varPropValue)db.Properties.Append prpResume NextElseChangeProperty = FalseExit FunctionEnd IfEnd FunctionIf the property does not exist yet, it will be created.Arno R 这篇关于以编程方式设置启动表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-09 08:05