Determine Object Type

后端 未结 2 1452
一个人的身影
一个人的身影 2021-01-05 05:59

Is there a way to determine the Object type, when passing a reference to a function?

I\'m using a security permissions function, which determines if the user has per

2条回答
  •  生来不讨喜
    2021-01-05 06:28

    Simplest way to determine the access type in access is to do an object lookup within the Access' system tables.

    Here would be the lookup:

    DLookup("Type","MSysObjects","NAME = '" & strObject & "'")
    

    strObject is the name of the object within Access

    The result is one of the number below OR NULL if the object does not exist in Access

    1 = Access Table
    4 = OBDB-Linked Table / View
    5 = Access Query
    6 = Attached (Linked) File  (such as Excel, another Access Table or query, text file, etc.)
    -32768 = Access Form
    -32764 = Access Report
    -32761 = Access Module
    

    so, the dlookup would provide "-32768" for a Form or "-32764" for a Report Hope that helps

提交回复
热议问题