object browser, help

MelB

Registered User.
Local time
Today, 00:00
Joined
Jun 14, 2002
Messages
32
I wish someone could point me to a resource that could help me understand the Object Brouser in Access. I am trying to figure out how to set a global string variable equal to the Access Security User Name. I can find in the brouser that Library DAO, has Classes Workspace, Document, and Container, and that all of them have UserName. Great... but how do I get the Username into a variable? If I ever understand the Object Brouser, will I someday understand VBA better???
 
MS Object Browser is simultaneously one of the neatest and one of the most frustrating tools in your Access VBA toolkit.

Want to find out the types of control you can have on a form or report? Set the Browser to the Access library, then in the left-hand window (Classes), click acControlType. On the right you will get an enumeration of the known control types.

Want to know the value of one of the symbols? Click on that symbol in the right-hand pane. At the bottom (beneath the classes and members panes) you will see that the constant has a value and is a member of Access.acControlType. But don't use the number. Use the symbol. Because, you see, the fact that you can see it through Object Browser means that if you use the text symbol, Access can see it too. And understand it!

Find out what that thing really is? There, you are at the mercy of the Help Files.

What object browser really does is read the symbol table segments associated with the compiled libraries named in that top section. The attributes of the symbol are stored in the symbol table because linker needs to know that information. Access needs to know it if you call something from another library. If you are a user of VB (not VBA, but straight VB), then you will need this information to be able to link to .DLL, .OCX, and other files. The things represented in the tables even include call sequences for functions and procedures and methods.

The beautiful part of the browser is that you can see a bunch of neat properties and methods associated with something. It can be a springboard for research. It can often be just enough to tell you how to proceed or the correct spelling of the attribute that you can't quite recall at the moment...

The frustrating part of the browser is that if you forget it is just a dumper of the contents of symbol tables or symbol directories, you will search for something that just isn't going to be there. And you'll go nuts trying to find "the little man that wasn't there."

Now, as to the user name issues, it all depends.

If you go into object browser and select <All Libraries> in the library selector, then put in UserName in the search box, you will find that Excel, Word, and DAO include the UserName as a property. Some of the comments in the bottom section indicate that you can set or return a username from the object that has that particular property.

The way you use the .UserName property depends on your context and what you are trying to do.

If you want to know the WorkGroup's name for a user, use the function CurrentUser(), which returns a string.

If you want to know who has rights on a document, find the documents collection containing that object, then find that object, then load a username to the .UserName property. When you do that, you can then read the .Permissions property to find out the kind of access something can have.

If you want to see the list of users or groups known for the current database, open its Workspace object. The users are listed in the Users collection. There is also a Groups collection that enumerates the groups.
 

Users who are viewing this thread

Back
Top Bottom