|
|
Finding the values of an Object's Properties
hello - The NorthWind db uses code like:
If CurrentDb().Properties("StartupForm") = "Startup" Then ...
in one of its modules. I have 2 newbie questions.
1) how can I determine (using VBA) the full set of CurrentDb's Properties?
(the names of the properties and their current values.)
2) This may be the same question, but will this work for any object? I need
a good way to list (again using VBA) the names and current values of any
Object's Properties?
much thanks
Sarah
|
|
0
|
|
|
|
Reply
|
Utf
|
2/2/2010 11:49:01 PM |
|
> how can I determine (using VBA) the full set of CurrentDb's Properties
The Object Browser (F2 or View -> Object Browser) lists all properties and
methods for each object currently referenced in your project. Their current
values can be applied to variables:
thisvar = CurrentDb.Properties("StartupForm")
or you can get them from the Immediate Window (Ctrl+G or View -> Immediate
Window):
?CurrentDb.Properties("StartupForm")
> but will this work for any object?
Yup. In most cases you reference the object itself, rather than it's
properties collection. Take a Form for instance... get it's Name property...
Dim strFormName As String
strFormName = Forms("ThisForm").Name
or it's Width:
?Forms("ThisForm").Width
or a Control:
Forms("ThisForm").Controls("ThisControl").ControlSource
> I need
> a good way to list (again using VBA) the names and current values of any
> Object's Properties?
Again, the Object Browser is a great place for this information. Often
though, I will use the built-in intellisense and just scroll the list that
pops up after you hit the "dot"
For instance, the keyword "Me" references the current form object, so when
you type:
Me.
you will see a list... this is a list of all of the Form's properties,
collections and methods - i.e. - everything you can do with the form.
Note that some properties are Read Only. Some are better left untouched.
happy coding!
--
Jack Leach
www.tristatemachine.com
"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
"Sarah" wrote:
> hello - The NorthWind db uses code like:
> If CurrentDb().Properties("StartupForm") = "Startup" Then ...
> in one of its modules. I have 2 newbie questions.
>
> 1) how can I determine (using VBA) the full set of CurrentDb's Properties?
> (the names of the properties and their current values.)
>
> 2) This may be the same question, but will this work for any object? I need
> a good way to list (again using VBA) the names and current values of any
> Object's Properties?
>
> much thanks
> Sarah
|
|
0
|
|
|
|
Reply
|
Utf
|
2/3/2010 12:06:10 AM
|
|
"Sarah" <Sarah@discussions.microsoft.com> wrote in message
news:6153C213-009B-4BE9-8BC3-E7CF63B2200F@microsoft.com...
> hello - The NorthWind db uses code like:
> If CurrentDb().Properties("StartupForm") = "Startup" Then ...
> in one of its modules. I have 2 newbie questions.
>
> 1) how can I determine (using VBA) the full set of CurrentDb's Properties?
> (the names of the properties and their current values.)
>
> 2) This may be the same question, but will this work for any object? I
> need
> a good way to list (again using VBA) the names and current values of any
> Object's Properties?
>
> much thanks
> Sarah
To find all the property names, take a look here:
http://msdn.microsoft.com/en-us/library/aa140020(office.10).aspx
also here (for all other properties) :
http://msdn2.microsoft.com/en-us/library/aa172326(office.11).aspx
|
|
0
|
|
|
|
Reply
|
Stuart
|
2/3/2010 12:17:56 AM
|
|
|
2 Replies
123 Views
(page loaded in 0.032 seconds)
Similiar Articles: Get property values from object. - microsoft.public.dotnet ...Hello. I need sample code of getting properties values of a specific object, please. Thanks :) ... How to implement IDictionary with <int, MyClass> members for ...// A copy of the SimpleDictionary object's key/value pairs. DictionaryEntry[] items; ... microsoft.public.dotnet.languages.csharp Each object has some properties. silly question - how to use properties of complex object ...Can you please explain, how to use object's properties, when there is an ... implicit call to the ToString method on the nested object (Datasource). If you want the value ... PropertyGrid - run through all of its properties - microsoft ...When PropertyGrid is connected to a selectedObject : How can I run through all of the object properties, which are seen on the propertyGrid, and get the name + value ? Printing the properties of an object - microsoft.public.access ...I have made sure the "Print Object" is selected in the picture's properties. ... know object properties of any object? Its very easy listing all the properties and values ... Deserialize XML to runtime object - microsoft.public.dotnet ...... class/object, the object has public properties, you populate the object's properties with ... XML Serialization with nullable values - microsoft.public.dotnet ... MailItem object has no property for when a reply was sent ...I've looked at the properties for the MailItem object. One of the MailItem properties is ... 0x1081 PR_LAST_VERB_EXECUTED That's different than your value ... Could not compare "1" to "System.Object[]" ...Error: "Cannot convert the "System.Object[] " value of type "System.Object[]" to type ... Our forum is dedicated to helping you find solutions with any problems, errors ... Error ==> You can't assign value to this object - microsoft ...If you still can't assign value to this object, post back with what you have found out. HTH -- Steve S ----- "Veni, Vidi, Velcro" (I came ... Creating array of specific object types dynamically - microsoft ...Depending on the object's types, the ... code demonstrates how ... Retrieving Specific Portions of a Date and Time Value ... Method for Binding to an Automation Object ... Finding the values of an Object's Properties DataBasehello - The NorthWind db uses code like: If CurrentDb().Properties(StartupForm) = Startup Then ... in one of its modules. I have 2 newbie questions. 1 RE: Finding the values of an Object's Propertieshow can I determine (using VBA) the full set of CurrentDb's Properties The Object Browser (F2 or View -> Object Browser) lists all properties and How to: Get and Set WMI Object PropertiesTo read and write Windows Management Instrumentation (WMI) object property values, you: Property Values of the HTML Object ElementThis topic describes properties of the DOM-level object element that are relevant ... Instead, provide this value as inner HTML for the object element. This technique is ... Show Object PropertiesIt also allows you to verify the properties of that object (maybe you can't remember ... // then the object's property value on a new line if (parent) { var msg = parent + "." 7/18/2012 8:39:13 AM
|
|
|
|
|
|
|
|
|