访问vba函数获取表单标题 [英] access vba function get form caption

查看:115
本文介绍了访问vba函数获取表单标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于所有

i,想知道是否有人之前遇到过这个问题,如果他有任何

解决方案

i得到了一个查询:


SELECT MSysObjects.Name,MSysObjects.Type,GETFRMCAPTION([Name])AS

Expr1

来自MSysObjects

WHERE(((MSysObjects.Type)= - 32768));


和此功能获取表格标题


公共函数GETFRMCAPTION(FRMNM As String)字符串


test =" Forms" &安培; "!" &安培; FRMNM& "。" &安培; 标题

GETFRMCAPTION = Eval(" Forms"&"!"& FRMNM&""&"" Caption")

/>
结束功能


但它不起作用


最后的结果我想获得表格标题稍后在应用程序的安全形式中添加的查询中的字段expr1



如果任何人可以帮助我解决这个问题,
i将会比感谢更多


提前多多感谢和问候

解决方案

请注意,Forms集合仅包含那些表格在代码运行时打开


因此,除非您先打开所有表格,否则此代码将不会返回

他们的标题。

无论如何我不认为.Caption属性没有打开

表格。

$ b $我不知道你想要什么形成。

虽然远非完美,但可用于Access的内置安全性绝对优于大多数你自己可以构建的东西。


HTH

- 海龟


" SELIM ZAIRI" < SE ******** @ HOTMAIL.COM>在消息中写道

新闻:2d ************************* @ posting.google.co m ... < blockquote class =post_quotes>对所有人来说,我想知道是否有人之前遇到过这个问题,如果他有任何解决方案
我得到了一个问题:

SELECT MSysObjects.Name,MSysObjects.Type,GETFRMCAPTION([Name])AS
Expr1
FROM MSysObjects
WHERE(((MSysObjects.Type)= - 32768));

此函数获取表单标题

公共函数GETFRMCAPTION(FRMNM As String)As String

test =" Forms" &安培; "!" &安培; FRMNM& "。" &安培; Caption
GETFRMCAPTION = Eval(" Forms"&"!"& FRMNM&""&"" Caption")

结束功能

但它不起作用

最终的结果我想获得表单标题在字段expr1
中的查询稍后会在安全性中添加申请表格

如果有人能帮我解决这个问题,我将非常感谢

提前多多感谢和问候



SELIM ZAIRI写道:

对所有人来说
我想知道是否有人之前遇到过这个问题,如果他有任何
解决方案
我得到了一个查询:

SELECT MSysObjects.Name,MSysObjects.Type,GETFRMCAPTION([Name])AS
Expr1
FROM MSysObjects
WHERE(((MSysObjects.Type)= - 32768));

此函数获取表单标题

公共函数GETFRMCAPTION(FRMNM As String)As String

test =" Forms" &安培; "!" &安培; FRMNM& "。" &安培; Caption
GETFRMCAPTION = Eval(" Forms"&"!"& FRMNM&""&"" Caption")

结束功能

但它不起作用

最终的结果我想获得表单标题在字段expr1
中的查询稍后会在安全性中添加申请表格

如果有人能帮我解决这个问题,我将非常感谢

提前多多感谢和问候




表格必须打开以获取它的标题。


尝试:

公共函数GETFRMCAPTION(FRMNM As String )作为字符串

DoCmd.OpenForm FRMNM,acDesign

GETFRMCAPTION =表格(GETFRMCAPTION).Caption

Docmd.Close FRMNM,acSaveNo
结束功能


跑步时有点乱。

-

但为什么朗姆酒会消失? br />


" Trevor Best" < NOSPAM @本地>在留言中写道

news:40 *********************** @ auth.uk.news.easyne t.net .. 。


表单必须打开以获取它的标题。

尝试:
公共函数GETFRMCAPTION(FRMNM As String)As字符串
DoCmd.OpenForm FRMNM,acDesign
GETFRMCAPTION =表格(GETFRMCAPTION).Caption
Docmd.Close FRMNM,acSaveNo
结束功能

运行。




如果你打开隐藏的每个表单,它会变得不那么混乱:


公共函数GETFRMCAPTION (FRMNM As String)As String

DoCmd.OpenForm FRMNM,acDesign ,,,, acHidden

GETFRMCAPTION = Forms(GETFRMCAPTION).Caption

Docmd.Close FRMNM,acSaveNo

结束功能

-

Doug Steele,Microsoft Access MVP
http://I.Am/DougSteele

(请不要发私人电子邮件)


hi, to all
i was wondering if some one got this problem before and if he had any
solution
i got a query:

SELECT MSysObjects.Name, MSysObjects.Type, GETFRMCAPTION([Name]) AS
Expr1
FROM MSysObjects
WHERE (((MSysObjects.Type)=-32768));

and this function to get form caption

Public Function GETFRMCAPTION(FRMNM As String) As String

test = "Forms" & "!" & FRMNM & "." & "Caption"
GETFRMCAPTION = Eval("Forms" & "!" & FRMNM & "." & "Caption")

End Function

but it will not work

the final result i want to get the form caption in the the field expr1
in the query to be added later in the security form of the application

i will be more than thankfull if any one could help me in this problem

many thanks and regards in advance

解决方案

Please recall that the Forms collection includes only those forms which are
open at the time that the code is run.
Therefore, unless you first open all the forms, this code will not return
their captions.
I don''t think that the .Caption property is available without opening the
forms, anyhow.

I''m not sure what you want this information for.
Although far from perfect, the built-in security available for Access is
most certainly superior to most anything you can build yourself.

HTH
- Turtle

"SELIM ZAIRI" <SE********@HOTMAIL.COM> wrote in message
news:2d*************************@posting.google.co m...

hi, to all
i was wondering if some one got this problem before and if he had any
solution
i got a query:

SELECT MSysObjects.Name, MSysObjects.Type, GETFRMCAPTION([Name]) AS
Expr1
FROM MSysObjects
WHERE (((MSysObjects.Type)=-32768));

and this function to get form caption

Public Function GETFRMCAPTION(FRMNM As String) As String

test = "Forms" & "!" & FRMNM & "." & "Caption"
GETFRMCAPTION = Eval("Forms" & "!" & FRMNM & "." & "Caption")

End Function

but it will not work

the final result i want to get the form caption in the the field expr1
in the query to be added later in the security form of the application

i will be more than thankfull if any one could help me in this problem

many thanks and regards in advance



SELIM ZAIRI wrote:

hi, to all
i was wondering if some one got this problem before and if he had any
solution
i got a query:

SELECT MSysObjects.Name, MSysObjects.Type, GETFRMCAPTION([Name]) AS
Expr1
FROM MSysObjects
WHERE (((MSysObjects.Type)=-32768));

and this function to get form caption

Public Function GETFRMCAPTION(FRMNM As String) As String

test = "Forms" & "!" & FRMNM & "." & "Caption"
GETFRMCAPTION = Eval("Forms" & "!" & FRMNM & "." & "Caption")

End Function

but it will not work

the final result i want to get the form caption in the the field expr1
in the query to be added later in the security form of the application

i will be more than thankfull if any one could help me in this problem

many thanks and regards in advance



The form has to be open to get it''s caption.

Try:
Public Function GETFRMCAPTION(FRMNM As String) As String
DoCmd.OpenForm FRMNM, acDesign
GETFRMCAPTION = Forms(GETFRMCAPTION).Caption
Docmd.Close FRMNM, acSaveNo
End Function

Bit messy when running.
--
But why is the Rum gone?


"Trevor Best" <nospam@localhost> wrote in message
news:40***********************@auth.uk.news.easyne t.net...


The form has to be open to get it''s caption.

Try:
Public Function GETFRMCAPTION(FRMNM As String) As String
DoCmd.OpenForm FRMNM, acDesign
GETFRMCAPTION = Forms(GETFRMCAPTION).Caption
Docmd.Close FRMNM, acSaveNo
End Function

Bit messy when running.



It''ll be a little less messy if you open each form as hidden:

Public Function GETFRMCAPTION(FRMNM As String) As String
DoCmd.OpenForm FRMNM, acDesign, , , , acHidden
GETFRMCAPTION = Forms(GETFRMCAPTION).Caption
Docmd.Close FRMNM, acSaveNo
End Function
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)


这篇关于访问vba函数获取表单标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆