1

I am attempting to restrict editing on certain layers based on the user log in.

Dim objLyr1
Dim objLyr2
Dim objLyr3
Set objLyr1 = Map.Layers("PatchPanel")
Set objLyr2 = Map.Layers("wHydrant")
Set objLyr3 = Map.Layers("ElectricPoles")
If UID = 2 Then
 Msgbox "Electric user. Only enable editing for Electric Users."
 objLyr1.Editable = True
 objLyr2.Editable = False
 objLyr3.Editable = True
ElseIf UID = 4 Then
 Msgbox "Water user. Only enable editing for Water Users."
 objLyr1.Editable = False
 objLyr2.Editable = True
 objLyr3.Editable = False

ElseIf UID = 3 Then
 Msgbox "Sewer user. Only enable editing for Sewer Users."
 objLyr1.Editable = False
 objLyr2.Editable = False
 objLyr3.Editable = False

Else
 Msgbox "Invalid user. Editing Unavailable"
 objLyr1.Editable = False
 objLyr2.Editable = False
 objLyr3.Editable = False
End If

This all happens after the log in is verified and the if statement works. The error message I'm getting says "error object required: 'objLyr1' Source Text Unavailable" It is error code 800A01A8.

I'm thinking the Map.Layers command may be generic for instructional documentation and I need to tailor it to my program but that's just a guess.

I'm not sure why and it is a rather vague error.

Does anyone have a clue to why I'm receiving this error?

1 Answer 1

1

The problem was where the script was being called. I moved the user validation if statement on map open. Everything worked as it should have after that change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.