Access Denied Error on DisplayDataMap

tbirdsimplemuse
01-15-2008, 12:51 PM
I am creating maps using Excel macros. When processing encounters the following code:


Set objDataMap = _
objDataSet.DisplayDataMap(geoDataMapTypeShadedArea , objField, _
geoShowByRegion2, geoCombineByDefault, _
geoRangeTypeUniqueValues, geoRangeOrderDefault, 15)

It errors with the following error text:

Runtime Error: '-2147024891 (800700005)': Access Denied

When the same code runs for a map that shows quintiled counties no problem. But when it runs for a map showing seed territories...BLAM!!...huge error.

This is driving me nuts...I cannot find any info about the error anywhere.

:roll: Any help is appreciated.

Eric Frost
01-15-2008, 01:58 PM
Can you post the ptm map files?

DisplayDataMap is a pain, I would try doing the simplest map first and then add parameters one at a time - you can see if it is just one of the parameters that is making it bomb.

Eric

tbirdsimplemuse
01-16-2008, 09:31 AM
Eric,

I tried to post a PTM file and could not do it. I was using the manage attachments tool in the reply to thread application. Is there another way?

Thanks,

Tbird

tbirdsimplemuse
01-16-2008, 11:41 AM
Thanks for the help with posting the files. I do not have zip software on my computer at work as we are pretty limited to what we get as far as software is concerned. Here is some code that might help:

Public Sub GenerateTerritory_Data_Map(strBook As String, strSheet As String, strContext As String)

Dim strLegendTitle As String

DataPath = Left(AbsPath, InStrRev(AbsPath, "\") - 1)
DataFile = DataPath & "\" & strBook & "!" & strSheet

If Not UCase(strContext) Like "*TERRITORY*" And Not LCase(TableName) Like "*datamap*" Then
Set objDataSet = objMap.DataSets.ImportTerritories(DataFile, aFields, geoCountryUnitedStates, , geoImportExcelSheet)
Else
Set objDataSet = objMap.DataSets.ImportData(DataFile, aFields, geoCountryUnitedStates, , geoImportExcelSheet)


If InStr(strContext, "bu") > 0 Then
Set objField = objDataSet.Fields("business unit")
strLegendTitle = "Business Units"
ElseIf InStr(strContext, "district") > 0 Then
If InStr(strContext, "datamap") > 0 Then
Set objField = objDataSet.Fields("Quintile Label")
strLegendTitle = "Quintiled Counties"
Else
Set objField = objDataSet.Fields("dist desc")
strLegendTitle = "Districts"
End If

ElseIf InStr(strContext, "territory") > 0 Then
If InStr(strContext, "datamap") > 0 Then
Set objField = objDataSet.Fields("Quintile Label")
strLegendTitle = "Quintiled Counties"
End If
Else
Set objField = objDataSet.Fields("terr desc")
strLegendTitle = "Territories"
End If

Set objDataMap = objDataSet.DisplayDataMap(geoDataMapTypeShadedArea , objField, _
, geoCombineByDefault, geoRangeTypeUniqueValues, geoRangeOrderDefault, 15)
End If


MsgBox "Order of data ranges in data map: " & _
objDataMap.DataRanges.DataRangeOrder


If Not UCase(strContext) Like "*TERRITORY*" Or LCase(TableName) Like "*datamap*" Then

objDataMap.LegendTitle = strLegendTitle
End If

objMap.MapStyle = geoMapStyleData
' If strLegendTitle = "Quintiled Counties" Then
' objDataSet.ZoomTo
' End If
'
' If the level is under national, zoom in
If Not UCase(strContext) Like "*NATIONAL*" Then
ResizeMap
'objDataSet.ZoomTo
End If

' Set the territory labels
If UCase(strContext) Like "*TERRITORY*" And Not LCase(TableName) Like "*datamap*" Then
objDataMap.LegendTitle = strLegendTitle
AddTerritoryLabel strContext
End If

End Sub


In this instance the strContext looks like this:
hierarchy_national_seed for the first tab in excel spreadsheet
hierarchy_district_seed for the next 1 to 4 tabs
hierarchy_territory_seed for the rest of the tabs

Thanks
Tbird:bluewink:

Mattys Consulting
01-16-2008, 06:45 PM
TBird,

I was able to dowload your zips.
Could you post the XLS also?
(There's some stuff missing from your posted code)

Mike Mattys

Mattys Consulting
01-18-2008, 08:54 AM
TBird,

My email is: mmattys at rochester.rr.com

 
Web mp2kmag.com
mapforums.com