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
Utf
2/2/2010 11:49:01 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

2 Replies
645 Views

Similar Articles

[PageSpeed] 49

> 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
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
Stuart
2/3/2010 12:17:56 AM
Reply:

Similar Artilces:

Can't find posting
I posted a question a couple of weeks ago and can't find my posting. It's frustrating!!! This is not the first time!!! I've checked it many many times!!! It's frustrating!!!! Please help. thanks chai Sometimes posts do get lost in cyberspace and never show on the list. Repost your question. Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "Chai" <Chai@discussions.microsoft.com> wrote in message news:D38193A4-F618-4722-B6B8-820D6C8FEA8C@microsoft.com... >I posted a question a couple of weeks ago and can't find m...

help needed to find value and add values in corresponding cells
hello. i need to first search a workbook for a number and return the value i the cell 3 over from it. i can do this using vlookup. but in som workbooks there are mutliple values (the one i look for) with mutipl values accross. eg part no. quantity 1 2 1 -- ghyne ----------------------------------------------------------------------- ghynes's Profile: http://www.officehelp.in/member.php?userid=51 View this thread: http://www.officehelp.in/showthread.php?t=75150 Visit - http://www.officehelp.in | http://www.officehelp.in/archive/index.php | http://www.officehelp.in...

Paste Values not working in Excel 2003 (?)
Hi, Using Excel 2003 with Win xp Pro I copy a range of cels, then I choose EDIT > PASTE SPECIAL > VALUES and it does NOT paste ALL the cel contentent... It does paste all the cels, but only the first 3 lines of each cel's content. Is there any limitation in the number of characters ? Thanks ALex This is not the exact problem you describe, put perhaps it's related: XL2000: "255 Characters in Cell" Error When Copying Worksheet, at: http://support.microsoft.com/default.aspx?scid=kb;en-us;213548 -- HTH - -Frank Isaacs Dolphin Technology Corp. http://vbapro.com ...

Merge text stacked upon an object into one picture?
I placed a graphic (vinal record disc) then stacked text upon it via text boxes. Can they be merged into one copyable picture? What version Publisher? Group the objects, right-click, save as picture. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Chiefhollis" <Chiefhollis@discussions.microsoft.com> wrote in message news:901225A7-9A8E-4046-BF7A-5FF17E06CB6D@microsoft.com... >I placed a graphic (vinal record disc) then stacked text upon it via text > boxes. Can they be merged into one copyable picture? It ...

macro to find date format in a cell and delete that entire row
macro to find date format in a cell and delete that entire row i have dates in a column and date keeps changing, i want that if macro find date in a column , it deletes that entire row help me thank u so much everyone for ue hel -- Message posted from http://www.ExcelForum.com try Sub deletedate() For Each c In Selection If IsDate(c) Then c.EntireRow.Delete Next End Sub -- Don Guillett SalesAid Software donaldb@281.com "vikram >" <<vikram.15ix9t@excelforum-nospam.com> wrote in message news:vikram.15ix9t@excelforum-nospam.com... > macro to find date format in a ...

Reference Grouped Objects Using VBA
Hello I have grouped four charts, three text boxes (from the control toolbox) and a rectangle. Prior to grouping, the code I had to update the axes on both charts and text for the text boxes worked fine. After grouping the objects the code fails. How do you reference a specific object contained in a group? If Shp is a grouped shape then Shp.GroupItems(2) references the second shape in the group -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware .. "BJ" <bradley.john@westrac.com.au> wrote in message Hello I have grouped four charts, three text ...

Finding hyperlinks in a spreadsheet
I'm using Excel 2007 and have a spreadsheet of name, addresses, email address and URL's Some of the email and URL addresses are not formatted correctly so they don't generate as a hyperlinked value in a cell. Is there a way to sort or find all the cells that contain a hyperlinked value? Thanks On Fri, 17 Jul 2009 17:40:06 -0500, JDR - Hotmail wrote in microsoft.public.excel: >I'm using Excel 2007 and have a spreadsheet of name, addresses, email >address and URL's > >Some of the email and URL addresses are not formatted correctly so they >don'...

finding data between two numbers (1000-1999)and totaling correspo.
I have a list of four digit numbers. I need to search the list and any that start with 10.. I have to total the numbers from a corresponding column of all that match this criteria and display it. one way: With 4 digit numbers in A1:A1000, and corresponding column B: =SUMPRODUCT(--(INT(A1:A1000/100)=10),B1:B1000) In article <C4DEBCF8-A553-4D5C-8B22-9251CCE9177D@microsoft.com>, plasticmaker <plasticmaker@discussions.microsoft.com> wrote: > I have a list of four digit numbers. I need to search the list and any that > start with 10.. I have to total the numbers fro...

Create a button to find the next record
Hi I am trying to create a button to find the next record for a particular studentID. There is a main form and subform. I want to be able to find all relevent subforms for a particular student. The master link id is STUDENTID and the child link id is STUDENTID_FK. So for student #1, when I click on the subform and click on the button, it would cycle through all this student's records. What is the best way to set up this button? Thank you for your help in advance. You already have one that is built in. Just click the navigation button right of the record number ...

Device properties registry permissions
Hello, What are the "correct" Win7 registry permission and ownership settings for device properties? When I try to view device Properties keys (e.g. enum\PCI) in Regedit a popup says: "Properties cannot be opened. An error is preventing this key from being opened. Details: Access is denied" even though I'm a machine administrator. When I try to view permissions a popup says: "You do not have permission to view the current permission settings for Properties, but you can make permissions changes." I can't even view the owner of the key. So...

Assign Values to String Value
Hello, I am trying to assign a numeric value to cells with string/text variables. For instance, 10-2 would signify 4 hours... so the value I would like to calculate would be 4. Is there an easy way to do this? Thanks "PC-Renew" wrote: > I am trying to assign a numeric value to cells with string/text variables. > For instance, 10-2 would signify 4 hours... so the value I would like to > calculate would be 4. Is there an easy way to do this? VLOOKUP would be, imo, the easiest. Eg: Assume textstring in A1: 11-7 Then in B1: =VLOOKUP(A1,{"10-2",4;"1...

Last Value in a Column when Value <> 0
Hi, can someone provide me a formula that populates a cell with the last value in a column that does not = 0? Below is an example 3 6 7 0 0 0 The goal is to populate a cell with the value of 7. I am currently using the below formula that populates the last value of a column: =INDEX('Retirement Total'!B:B,MATCH(9.99999999999999E+307,'Retirement Total'!B:B)) I do not however know how to change this to not populate the last value when it is zero. Your help is appreciated. Assuming you want the last *numeric* value that <>0. Try something like this: =LOOKUP(1E100,1/'...

how to find the operating syetem year in vba
Hello, i need to find out what the o.s. year is in vba so that i can delete tab on a sheet. my sheet has several tab, some which i don't want to delete like "ledger" "2008" and the current year "2009" if i add extra years i would like to be able to delete years "2010" + i have some code wich add the years to my sheet which basicaly copys previous years and clears all the contents and renames it to the next year, in doing so it all so adds various totals to my "ledger" sheet. For Each sh In Sheets If sh.Name = "Ledger&q...

How do I find and replace a question mark in Excel?
I have a range of cells with a single question mark ?, Y or N. I can't filter with the question mark since Excel thinks it's a wild card. I wasn't aware of this when I set up the spreadsheet. So I would like to replace the question marks with something else, but this still presents the same problem. How can I specify that I mean a question mark and not a wild card? Thanks. use ~? instead and this will tell Excel to look for a ? as a ? and not as a wildcard. -- Regards Ken....................... Microsoft MVP - Excel Sys Spec - Win XP Pro / XL 9...

How do I code the cloning of an object in vba?
Specifically a frame containing both a textbox control and a spinbutton control. Thanks Steve Can you be more specific? What are you wanting to do? Are you just wanting to copy a control to another userform? -- Cheers, Ryan "sarndt" wrote: > Specifically a frame containing both a textbox control and a spinbutton > control. > > Thanks > > Steve ...

Copy a value without linking?
I am trying to automatically set the value of a text box within a subform when the user creates a new record in that subform. I want the value to be pulled from another form (the main form which the subform is linked to) in the database, but I do not want the value to ever be updated. In other words, I want to just copy the value from the main from to the test box on the subform-- once and only once. Example: MainForm: field="Name" (field is a combo box) Subform: field="NameAtTimeRecordWasCreated" (field is a text box) The "Name" field on MainForm...

Average w/o Zero Values
Was wondering if anyone could kindly suggest a method of determining the average of a column (or row) of numbers but not including any cells with a value of zero? Also, if a range is conditionally formated to flag numerical values not within a certain range, how can one prevent it from flagging cells which are set = blank or empty? TIA for any assistance............. Laurie Forbes Hi Laurie: For averages excluding zeros you can use: =AVERAGE(IF(MyRange,MyRange)) Entered as an array by pressing Ctrl + Shift and then pressing Enter With your conditional formatting problem. Use a first c...

how do i use format cells to alpha / numeric values
HAVE A STRING OF DATA i WANT TO ENTER into a cell, but I also want to set format to set the values. eg. if I put in asd123 I want it to appear as ASD123 but there are also occasions when I will put in a different mix of letters/numbers a12s3d, which I also want to come out as A12S3D. I can do this in Access but cant seem to crack the code in excel. Please help. Try =UPPER(E2) HTH Regards, Howard "Samvid69" <Samvid69@discussions.microsoft.com> wrote in message news:701E3143-A79D-4FDE-8661-325795CE50F0@microsoft.com... > HAVE A STRING OF DATA i WANT T...

How do Bar chart where Bar colour changes with different data Valu
hi, I would like to develop a Bar chart, which changes its bar colour for different data values. e.g for a cell format and to change colour of a cell for different values we can use conditional format. Hi, Have a look an Jon's example of conditional charts. http://peltiertech.com/Excel/Charts/ConditionalChart1.html Cheers Andy Zeeshan wrote: > hi, > I would like to develop a Bar chart, which changes its bar colour for > different data values. e.g for a cell format and to change colour of a cell > for different values we can use conditional format. -- Andy Pope, Micro...

re-sizing 2 objects...
I am trying to make 2 areas be resizable. EX: 2 lists divided by a button. I've written code where I have a button between the 2 areas (2 lists). The button has an DrawItem function which doesn't do any thing until the user starts to drag. So.. the button is (technically) invisible... tho I change the cursor when over it so that the user knows it is there. I figured that a button would capture the mouse... then I could move the button on the fly until the user let up. Then I could re-size the 2 areas. My prob is that there is a LOT of flickering... As the user drags and my ...

Using a cell's value in a macro command
Hi, I need to use a value of a cell in a spreadsheet in a macro command to copy data. For Example. cell A1 = 28/09/2009 Sub Workbooks.Open Filename:= _ "C:\(Value from A1)" End Sub Thanks, Tom hi try something like this......... Dim r As String r = Range("A1").Value Workbooks.Open Filename:= _ "C:\your\file\path\" & r & ".xls" but in your example data, you have slashes. these are illigal characters in a file name so i doubt that you have a file with slashes in the name. exc...

Finding Duplicates
Hi all, I'm running Access 2007 and would like to know if this logic is correct for searching duplicates in two tables. I'm trying to find my renewal rate between all clients from last year (stored in one table) and all clients from this year (stored in another table). The logic would be to see which clients from last year are still clients this year. Here's the SQL statement: -- SELECT [Patient Renewals - 2007 Shoe Patients].pat_number, [Patient Renewals - 2007 Shoe Patients].f_name, [Patient Renewals - 2007 Shoe Patients].l_name, [Patient Renewals - 2007 Shoe Patients].item...

Pivot Table Form
Hi Everyone, I have a Pivot Table Form in Access 2003 and need the blank/null cells on the data axis to display "0". This is easy to do in Excel but I have searched through all of the options in Access and cannot find it. What is the VBA code required to set this option? Can anyone suggest a good reference book or website for coding Pivot Tables with VBA? Many thanks, David Hi David, can't you use the calculated value NZ([myvalue],0) instead of the value itself? -- Kind regards Noëlla "David Saywell" wrote: > Hi Everyone, > > I have a Piv...

UML Activity Object in State
Hi all, I've just started using Visio fopr my UML diagrams and am trying to complete an activity diagram, which will show the state of an object all the way through a process. Problem is when I add an object in state box to my diagram the State option is always greyed out. How can I change this? Thanks for your help Matt ...

Inherited Class with property of same name in base class err in We
There is a Web Service containing two classes: public class Class1 { public Class1() { } public string Name; } public class Class2 : Class1 { public Class2() { } public new string[] Name; } And there is a web method: [WebMethod] public Class2 Test() { return new Class2(); } I can compile the code, however, an exception was thrown when accessing the web service: Member Class2.Name of type System.String[] hides base class member Class1.Name of type System.String. Use XmlElementAttribute or XmlAttributeAttribute to specify a new name. I have tried the fo...