本文介绍了我想列出已保存的querydef,其中包含“tblCorrespondence”和“tblCorrespondence”。在他们的SQL中......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有以下代码列出Access 2.0' 立即窗口中的查询名称。目前,它列出了所有已保存查询的名称。 您是否可以建议进行修改,以便仅列出 引用tblCorrespondence的查询名称? Sub ListSavedQrys_Click() ''*************************** ********************** ***************** ''列表即时窗口中的所有表名。 '' ''这在许多应用程序中都很有用。保存在模板中& ''在需要时引用它。使用DAO。 ''************************************* ************ ***************** 错误GoTo Err_ListSavedQrys_Click Dim ThisForm As String ThisForm = Me.Name Dim MyQryDef作为QueryDef,MyDatabase作为数据库,我作为整数, HowManyQrys作为整数 设置MyDatabase = DBEngine.Workspaces(0).Databases(0) 设置MyQryDef = MyDatabase.CreateQueryDef(" _TestOnly") HowManyQrys = MyDatabase.QueryDefs.Count 如果HowManyQrys> 99那么 MsgBox"有 &安培; CStr(HowManyQrys)& "保存的查询。 即时窗口只显示99行。 结束如果 Debug.Print CStr(HowManyQrys) 退出Sub For I = 0 To HowManyQrys - 1 Debug.Print MyDatabase.QueryDefs(I).Name Next I MyDatabase.QueryDefs.Delete" _TestOnly" Exit_ListSavedQrys_Click: 退出子 Err_ListSavedQrys_Click: Dim r As String,k As String,Message3 As String r =" Sub发生以下意外错误 ListSavedQrys_Click,CBF on &安培; ThisForm& "。" k = CRLF& CRLF& Str $(Err)& : &安培;报价和报价错误$&引用 Message3 = r& k MsgBox Message3,48,意外错误 - &安培; MyApp $& ",rev。 " & MY_VERSION $ 恢复Exit_ListSavedQrys_Click 结束子 解决方案 (Err)& : &安培;报价和报价错误 &安培;引用 Message3 = r& k MsgBox Message3,48,意外错误 - &安培; MyApp的 &安培; ",rev。 " & MY_VERSION I have the following code to list query names in Access 2.0''sImmediate Window. Currently, it lists names of all saved queries.Can you suggest a modification that will result in it listing onlynames of queries referencing "tblCorrespondence"? Sub ListSavedQrys_Click ()''************************************************* *****************'' Lists ALL the table names in the immediate window.'''' This is useful code in many applications. Save it in template &'' refer to it whenever needed. Uses DAO.''************************************************* ***************** On Error GoTo Err_ListSavedQrys_ClickDim ThisForm As StringThisForm = Me.Name Dim MyQryDef As QueryDef, MyDatabase As Database, I As Integer,HowManyQrys As IntegerSet MyDatabase = DBEngine.Workspaces(0).Databases(0)Set MyQryDef = MyDatabase.CreateQueryDef("_TestOnly")HowManyQrys = MyDatabase.QueryDefs.CountIf HowManyQrys > 99 ThenMsgBox "There are " & CStr(HowManyQrys) & " saved queries. Theimmediate window will only display 99 lines."End IfDebug.Print CStr(HowManyQrys)Exit SubFor I = 0 To HowManyQrys - 1Debug.Print MyDatabase.QueryDefs(I).NameNext IMyDatabase.QueryDefs.Delete "_TestOnly" Exit_ListSavedQrys_Click:Exit Sub Err_ListSavedQrys_Click:Dim r As String, k As String, Message3 As Stringr = "The following unexpected error occurred in SubListSavedQrys_Click, CBF on " & ThisForm & "."k = CRLF & CRLF & Str$(Err) & ": " & QUOTE & Error$ & QUOTEMessage3 = r & kMsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &MY_VERSION$Resume Exit_ListSavedQrys_Click End Sub 解决方案 (Err) & ": " & QUOTE & Error& QUOTEMessage3 = r & kMsgBox Message3, 48, "Unexpected Error - " & MyApp& ", rev. " &MY_VERSION 这篇关于我想列出已保存的querydef,其中包含“tblCorrespondence”和“tblCorrespondence”。在他们的SQL中......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-30 01:02