Hello Eric,

You need to use an "alias". Although you have assigned szLayerName a table
name, you cannot access .obj from it. The rule-of-thumb is that if you have
a variable containing a table name, you need to use an alias to get any
fields from that table. When an alias variable is encountered, it is
interpreted literally by MapBasic. The following should work:

Include "MapBasic.Def"

Dim szLayerName As String
dim ObjAlias as alias

szLayerName = LayerInfo(FrontWindow(), 1, LAYER_INFO_NAME)
ObjAlias = szLayerName+".obj"

Fetch First From szLayerName

Dim obj_type As Integer
obj_type = ObjectInfo(ObjAlias, OBJ_INFO_TYPE)

Regards,
Warren Vick
Europa Technologies Ltd, U.K.
http://www.europa-tech.com

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Eric Frost / HR and
> Associates, Inc.
> Sent: Monday, August 14, 2000 6:10 PM
> To: [EMAIL PROTECTED]
> Subject: MI LAYER_INFO_NAME and ObjectInfo
>
>
>
> What is wrong with this code:
>
> Include "MapBasic.Def"
>
> Dim szLayerName As String
> szLayerName = LayerInfo(FrontWindow(), 1, LAYER_INFO_NAME)
>
> Fetch First From szLayerName
>
> Dim obj_type As Integer
> obj_type = ObjectInfo(szLayerName.obj, OBJ_INFO_TYPE)
>
> I have tried all sorts of work-arounds like assigning the object to an
> object variable and Run Command but have not hit on the solution.
>
> Thanks in advance!
>
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
>

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to