shrug-l: VBA Search

Frank Price fprice at fnai.org
Tue Apr 14 18:55:07 EDT 2009


Sorry Keith, In my last response I missed where you said VBA - "IN" only
works in SQL (in the select by attributes dialog in ArcMap)

 

Here's a format that should work, let me know if it doesn't:

 

In the calculate field tool dialog put this in the "Code Block" box and in
the "Expression" box just put "reg" 

 

Dim reg As String

 

Select Case LCase([County]) 

Case "escambia","santa rosa","okaloosa" 

   reg = "Northwest" 

Case "broward","lee"

   reg = "South"

End Select

 

 

Frank Price

Florida Natural Areas Inventory

1018 Thomasville Road, Suite 200-C

Tallahassee, Florida  32303

telephone:  (850) 224-8207 x 210

fax:  (850) 681-9364

www.fnai.org <http://www.fnai.org/> 

Tracking Florida's Biodiversity

 

 

From: shrug-l-bounces at lists.dep.state.fl.us
[mailto:shrug-l-bounces at lists.dep.state.fl.us] On Behalf Of Sandell, Keith
M.
Sent: Tuesday, April 14, 2009 4:54 PM
To: shrug-l at lists.dep.state.fl.us
Subject: FW: shrug-l: VBA Search

 

Feeling kinds stupid here.

 

I tried the IN operator, but I keep getting ESRI's default, catch all error
999999. Does it matter if it is part of an If, Then statement?

 

Here is part of the original statement that worked.It is actually a
Pre-Logic VBA Statement for a Calculate Field component of a geoprocessing
model.

 

Dim reg As String

 

If LCase( [County] ) = "escambia" OR LCase( [County] ) = "santa rosa" OR
LCase( [County] ) = "okaloosa" OR LCase( [County] ) = "walton" _

OR LCase( [County] ) = "holmes" OR LCase( [County] ) = "washington" OR
LCase( [County] ) = "bay" OR LCase( [County] ) = "jackson" _

OR LCase( [County] ) = "calhoun" OR LCase( [County] ) = "gulf" OR LCase(
[County] ) = "gadsden" OR LCase( [County] ) = "liberty" _

OR LCase( [County] ) = "franklin" OR LCase( [County] ) = "leon" OR LCase(
[County] ) = "wakulla" OR LCase( [County] ) = "jefferson" Then

reg = "Northwest"

 

End If

 

I tried variations on the theme (syntax) with the IN operator, but could not
get any to work.

 

.or perhaps it is too late in the day to be doing this. J

 

Any thoughts on what I might be doing wrong.

 

Thanks/

 

Keith Sandell, MBA

Correctional Services Assistant Consultant

Florida Department of Corrections

Phone: (850) 410-3045

Fax: (850) 487-4427

 

 

From: shrug-l-bounces at lists.dep.state.fl.us
[mailto:shrug-l-bounces at lists.dep.state.fl.us] On Behalf Of Sandell, Keith
M.
Sent: Tuesday, April 14, 2009 3:55 PM
To: shrug-l at lists.dep.state.fl.us
Subject: shrug-l: VBA Search

 

Hey Shruggers,

 

I'm writing some VBA that searches for specific occurrences of words. Is
there a better way to write --- [County] = "marion" OR [County] = "citrus"
---, i.e. [County] = "marion, citrus"

 

So I don't have to repeat the syntax again, and again.

 

Thanks/

 

Keith Sandell, MBA

Correctional Services Assistant Consultant

Bureau of Probation and Parole Field Services

Office of Community Corrections

Florida Department of Corrections

2601 Blairstone Road

Tallahassee, Florida 32399

Phone: (850) 410-3045

Fax: (850) 487-4427

 

 

This electronic message may contain protected health record/care information
intended for addressee(s) only. Unauthorized release or disclosure may
violate state and/or federal laws.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20090414/62ab050d/attachment.htm


More information about the SHRUG-L mailing list