|
-
Jul 29th, 2005, 10:03 AM
#1
Thread Starter
Frenzied Member
Finding system objects - Access 2K [Resolved]
I'm populating a listbox with the names of the tables, queries, forms, etc, in the database. The eventual goal is to be able to make changes in one template database and have a form that will copy the changes to about sixty other db's automatically.
Anyway, I don't want the (normally) hidden system objects to appear in the listbox. I know I could check Left(tbl.Name, 4) for "Msys", but is there a more OOP way, like checking for a system or hidden property?
Also, is there a reason that there's no .AddItem property for a standard listbox?
Thanks.
VB Code:
Dim ObjAO As AccessObject
Dim Obj As Object
Dim s As String
Set Obj = Application.CurrentData
lstObjects.RowSourceType = "Value List"
For Each ObjAO In Obj.AllTables
If Not ObjAO.blah = vbSystem Then 'This is where I want a check
s = s & ObjAO.Name & ";"
End If
Next
lstObjects.RowSource = s
Last edited by salvelinus; Jul 31st, 2005 at 11:01 AM.
Tengo mas preguntas que contestas
-
Jul 31st, 2005, 07:04 AM
#2
Re: Finding system objects - Access 2K
To the best of my knowledge I think the only way you can determine the system tables is through left(tablename,4) = "Msys" method that you have mentioned...
Don't have Access 2000 installed, but could of sworn that .Additem was introduced in this version.. it's definately not in Access 97
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Jul 31st, 2005, 09:41 AM
#3
Thread Starter
Frenzied Member
Re: Finding system objects - Access 2K
Thanks. There's an .AddItem method for a commandbar listbox in 2000, but apparently not for a toolbox one.
Another odd thing is that you have to use .CurrentData to iterate tables & queries with a For Each statement, but .CurrentProject for forms & reports.
Tengo mas preguntas que contestas
-
Jul 31st, 2005, 10:12 AM
#4
Re: Finding system objects - Access 2K
That'll be because .CurrentData refers to uncodable items such as Tables and Queries.. And .CurrentProject Refers to codable items such as Forms, Reports and modules.
You could also use the Document Property for all objects
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Jul 31st, 2005, 10:17 AM
#5
Re: Finding system objects - Access 2K
You can run a query against the system table.
VB Code:
"SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') " & _
"AND (Left$([Name],4) <> 'Msys') AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name;"
This will retrieve all the user Tables in the DB.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 31st, 2005, 11:01 AM
#6
Thread Starter
Frenzied Member
Re: Finding system objects - Access 2K
Thanks both, that's usefull info I didn't know. The MSysObjects table is nice to know.
Tengo mas preguntas que contestas
-
Jul 31st, 2005, 11:12 AM
#7
Thread Starter
Frenzied Member
Re: Finding system objects - Access 2K
 Originally Posted by dannymking
That'll be because .CurrentData refers to uncodable items such as Tables and Queries.. And .CurrentProject Refers to codable items such as Forms, Reports and modules.
You could also use the Document Property for all objects
Well, you'd think there'd be one property that could reference all. Not familiar with the Document property, will look that up Monday.
Tengo mas preguntas que contestas
-
Jul 31st, 2005, 12:08 PM
#8
Re: Finding system objects - Access 2K [Resolved]
Document propert is actually an element of DAO..
VB Code:
Sub GetTableNames()
Dim Db As DAO.Database
Dim Doc As DAO.Document
'Initialize the DAO Database by setting it to the current database
Set Db = CurrentDb
'Now loop around the number of tables found within the database, because we are using the documents collection
'we do not need to set an upper and lower limit
For Each Doc In Db.Containers!Tables.Documents
'Display each tablename to the immediate window
Debug.Print Doc.Name
Next Doc
'Close the reference
Set Db = Nothing
End Sub
Subsitute Tables for Forms, Modules, Reports or Queries
Last edited by dannymking; Jul 31st, 2005 at 12:12 PM.
Reason: More explanation
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Jul 31st, 2005, 12:22 PM
#9
Re: Finding system objects - Access 2K [Resolved]
Ok, got the rest of the objects...
VB Code:
'Queries:
"SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') " & _
"AND (MSysObjects.Type)=5 ORDER BY MSysObjects.Name;"
'Reports:
"SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') " & _
"AND (MSysObjects.Type)= -32764 ORDER BY MSysObjects.Name;"
'Forms:
"SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') " & _
"AND (MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;"
'Modules:
"SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') " & _
"AND (MSysObjects.Type)= -32761 ORDER BY MSysObjects.Name;"
'Macros:
"SELECT MSysObjects.Name FROM MsysObjects WHERE (Left([name], 1) <>'~') " & _
"AND (MSysObjects.Type)= -32766 ORDER BY MSysObjects.Name;"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 31st, 2005, 11:09 PM
#10
Thread Starter
Frenzied Member
Re: Finding system objects - Access 2K [Resolved]
Thanks, but who the heck ever heard of (MSysObjects.Type)= -32766?
It would just be a lot simpler if MS gave this stuff a boolean System property.
But I do appreciate your help. Thanks.
Tengo mas preguntas que contestas
-
Jul 31st, 2005, 11:51 PM
#11
Re: Finding system objects - Access 2K [Resolved]
Well the Type is Access' constant value for a Form (-32768). If you have ever browsed through the system tables you will see allot of records with field values like this. Its just the way Access does it.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2005, 01:06 PM
#12
Thread Starter
Frenzied Member
Re: Finding system objects - Access 2K [Resolved]
I suppose it would be helpful to do that, but it still seems like there ought to be a property to check. If I see a value like 32768 I start thinking of the limit to integer values, 32767.
Tengo mas preguntas que contestas
-
Aug 1st, 2005, 01:21 PM
#13
Re: Finding system objects - Access 2K [Resolved]
You could also do this by opening the DB Schema via ADOX but it will be more work and code since you will have to make a few calls to the db. One for the tables, then one for its field types. Then repeat for each db object type.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2005, 01:58 PM
#14
Thread Starter
Frenzied Member
Re: Finding system objects - Access 2K [Resolved]
Aaaghh! That's my whole point. There ought to be a simple object property to check, like .Visible. MS, grrr...
Tengo mas preguntas que contestas
-
Aug 1st, 2005, 02:08 PM
#15
Re: Finding system objects - Access 2K [Resolved]
Maybe you could execute the menu items to do a Tools > Anaylze > Documenter with the DoCmd.DoMenuItem ?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2005, 03:29 PM
#16
Thread Starter
Frenzied Member
Re: Finding system objects - Access 2K [Resolved]
I'm fine with gritting my teeth & muttering "G-D MS". But thanks.
Tengo mas preguntas que contestas
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|