473,564 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine object type if have name?

MLH
Suppose MyName, a string variable
equals "frmEnterClient s". How can I
determine ...

1) if frmEnterClients exists as an object in the database?
2) what type of object is it (tbl, qry, frm, rpt, mac, mod)?
Mar 7 '06 #1
5 6832
Br
MLH wrote:
Suppose MyName, a string variable
equals "frmEnterClient s". How can I
determine ...

1) if frmEnterClients exists as an object in the database?
2) what type of object is it (tbl, qry, frm, rpt, mac, mod)?


One way would be to use the MSysObjects system table:

This will list all the queries in the database:

SELECT DISTINCTROW MSysObjects.Nam e
FROM MSysObjects
WHERE (((MSysObjects. Type)=1 Or (MSysObjects.Ty pe)=5 Or
(MSysObjects.Ty pe)=6) AND ((Left$([Name],4))<>"MSys"))
ORDER BY MSysObjects.Nam e;

You could reverse it by looking for a name and return the type...
--
regards,

Br@dley
Mar 7 '06 #2
MLH
Thx, Br@dley
I think you're on to something.
What are all those Type 5 entries in MSysObjects with names like
~sq_ffrmAddnlOw nrEntryFrm

I haven't knowingly created or named any objects beginning with ~sq_f
but there are lots of them in MSysObjects table.
Mar 7 '06 #3
MLH
Jumpstarted off your SQL, I modified it a bit further...

SELECT MSysObjects.Nam e, MSysObjects.Typ e
FROM MSysObjects
WHERE (((MSysObjects. Name) Not Like "~sq_*" And (MSysObjects.Na me) Not
Like "MSys*") AND (Not ((MSysObjects.T ype)=6 Or (MSysObjects.Ty pe)=8
Or (MSysObjects.Ty pe)=3 Or (MSysObjects.Ty pe)=2 Or
(MSysObjects.Ty pe)=-32757 Or (MSysObjects.Ty pe)=-32758)))
ORDER BY MSysObjects.Typ e DESC;

This way, the qry dynaset displays only deliberately created objects,
excluding system objects. The types shown seem to be
Type 1, 5, -32761, -32764, -32766 and -32768
(tables, queries, modules, reports, macros and forms respectively)
Mar 7 '06 #4
Just a suggestion, you're SQL would be more readable if you use the IN
clause e.g.
SELECT [Name], Type
FROM MSysObjects
WHERE [Name] Not Like "~sq_*"
AND [Name] Not Like "MSys*"
AND Type Not In (6,8,3,2,-32757,-32758)
ORDER BY Type DESC;
--

Terry Kreft
"MLH" <CR**@NorthStat e.net> wrote in message
news:05******** *************** *********@4ax.c om...
Jumpstarted off your SQL, I modified it a bit further...

SELECT MSysObjects.Nam e, MSysObjects.Typ e
FROM MSysObjects
WHERE (((MSysObjects. Name) Not Like "~sq_*" And (MSysObjects.Na me) Not
Like "MSys*") AND (Not ((MSysObjects.T ype)=6 Or (MSysObjects.Ty pe)=8
Or (MSysObjects.Ty pe)=3 Or (MSysObjects.Ty pe)=2 Or
(MSysObjects.Ty pe)=-32757 Or (MSysObjects.Ty pe)=-32758)))
ORDER BY MSysObjects.Typ e DESC;

This way, the qry dynaset displays only deliberately created objects,
excluding system objects. The types shown seem to be
Type 1, 5, -32761, -32764, -32766 and -32768
(tables, queries, modules, reports, macros and forms respectively)

Mar 8 '06 #5
MLH
That really did make it much
more legible. Thx, Terry.
Mar 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6486
by: Christian Christmann | last post by:
Hi, I've a some classes which are all inherited from the same base class class_BASE; There's another class which holds some information and is "bound" to one of the inherited classes indicated by the member attibute class_BASE *mElement;
0
1580
by: Dan Noel | last post by:
I am implementing a DataStore/Settings object that stores objects in XML by serializing the objects in XML and then associating these objects with key names. At some later point, I want to retrieve the object associated with a given keyname, but I am running into trouble deserializing objects into the correct object type. Nearly all of...
1
2279
by: Dan | last post by:
All, I am working on an application that allows users to track various items for various clients. For example Client A may have an object Box where Client B has an object Canister. When a user goes to enter a new object I would like the application to determine what objects are available based upon the client (easy enough) and when they...
2
9485
by: CJack | last post by:
hi, i have a window form with different controls. i want to loop through all the controls and write the types and lables of each control in a file. I dnt know how to determine the type of a control that wether it is a button, lable or text box. any body out there to help please. thanks in advance
2
3829
by: gael | last post by:
is it possible to get the object type or name from its name?
6
4321
by: Jan Warning | last post by:
Hi, how can I determine (at run time) the type of an Object and how can I use the obtained result to do a type conversion with CType? I tried something like: dim myType as type myType = sender.GetType CType(sender, myType) This however generates a compiler error: Type 'myType' is not defined What is the proper way to do this?
7
11923
by: Martin Robins | last post by:
I am currently looking to be able to read information from Active Directory into a data warehouse using a C# solution. I have been able to access the active directory, and I have been able to return "DirectoryEntry" objects within the path that I specify (either using the DirectoryEnrtry.Children or using the DirectorySearcher class) and all...
1
1367
by: abducted | last post by:
mywidget = new Widget() alert(mywidget) // object Object alert(mywidget.toString()) // object Object alert(mywidget+"") // object Object alert(String(mywidget)) // object Object I have always wondered if there was a way to get the string "mywidget". A potential use could avoid things like this:
4
2689
by: Bill Fuller | last post by:
I am trying to determine the type for ActiveControls using 3rd party controls (Infragistics in this case) during runtime and getting a rather odd return type at runtime for the UltraWinEditor. Code shippet is as follows: if ( ActiveControl.GetType() == typeof(UltraTextEditor)) { UltraTextEditor tb = (UltraTextEditor) this.ActiveControl;...
0
7665
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.