Connecting Tech Pros Worldwide Forums | Help | Site Map

How to specify alpha array(a-z)?

deko
Guest
 
Posts: n/a
#1: Nov 12 '05
Is it possible to define an array of all alpha characters?

Array(a-z) doesn't seem to work....

Here's the code:

For Each varAppt In cf.Items
If varAppt.Location <> "United States" And _
varAppt.Location <> "" _
And varAppt.Start > Date - 31 Then
varAlpha = Array("a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x",
"y", "z")
For i = 0 To UBound(varAlpha)
j = InStr(1, varAppt.Location, varAlpha(i))
If j > 0 Then
varAppt.Location = "0" 'zero-out any location that
contains an alpha character
End If
Next
rst.AddNew
rst!Entity_ID = varAppt.Location
rst!ApptDate = varAppt.Start
rst!Subject = varAppt.Subject
rst.Update
End If
Next



Mapzoid
Guest
 
Posts: n/a
#2: Nov 12 '05

re: How to specify alpha array(a-z)?


Hint: chr(65) = A chr(90) = Z. Run with it
deko
Guest
 
Posts: n/a
#3: Nov 12 '05

re: How to specify alpha array(a-z)?


Thanks for the tip.

Here's what I came up with:

For intI = 33 To 47
varA = Chr(intI)
j = InStr(1, varAppt.Location, varA, vbTextCompare)
If j > 0 Then varAppt.Location = "0"
Next intI

For intI = 58 To 126
varA = Chr(intI)
j = InStr(1, varAppt.Location, varA, vbTextCompare)
If j > 0 Then varAppt.Location = "0"
Next intI

Is there a way to use one For loop instead of two?

this does not work...

For intI = 33 To 47, 58 To 126
varA = Chr(intI)
j = InStr(1, varAppt.Location, varA, vbTextCompare)
If j > 0 Then varAppt.Location = "0"
Next intI

What I'm trying to do is make the string value varAppt.Location = "0" if
it's not a number.
as you know, the Ascii values for 0-9 are Chr(48) - (57)

"Mapzoid" <mapzoid@aol.com> wrote in message
news:20031206150637.04241.00000372@mb-m29.aol.com...[color=blue]
> Hint: chr(65) = A chr(90) = Z. Run with it[/color]


rkc
Guest
 
Posts: n/a
#4: Nov 12 '05

re: How to specify alpha array(a-z)?



"deko" <dje422@hotmail.com> wrote in message
news:4nuAb.66616$cG7.16482@newssvr25.news.prodigy. com...[color=blue]
> Thanks for the tip.
>
> Here's what I came up with:
>
> For intI = 33 To 47
> varA = Chr(intI)
> j = InStr(1, varAppt.Location, varA, vbTextCompare)
> If j > 0 Then varAppt.Location = "0"
> Next intI
>
> For intI = 58 To 126
> varA = Chr(intI)
> j = InStr(1, varAppt.Location, varA, vbTextCompare)
> If j > 0 Then varAppt.Location = "0"
> Next intI
>
> Is there a way to use one For loop instead of two?
>
> this does not work...
>
> For intI = 33 To 47, 58 To 126
> varA = Chr(intI)
> j = InStr(1, varAppt.Location, varA, vbTextCompare)
> If j > 0 Then varAppt.Location = "0"
> Next intI
>
> What I'm trying to do is make the string value varAppt.Location = "0" if
> it's not a number.
> as you know, the Ascii values for 0-9 are Chr(48) - (57)[/color]

Look up the IsNumeric function in Help.





deko
Guest
 
Posts: n/a
#5: Nov 12 '05

re: How to specify alpha array(a-z)?


um, yeah... that works, too.

"rkc" <rkc@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:BaxAb.187817$1N3.11907@twister.nyroc.rr.com.. .[color=blue]
>
> "deko" <dje422@hotmail.com> wrote in message
> news:4nuAb.66616$cG7.16482@newssvr25.news.prodigy. com...[color=green]
> > Thanks for the tip.
> >
> > Here's what I came up with:
> >
> > For intI = 33 To 47
> > varA = Chr(intI)
> > j = InStr(1, varAppt.Location, varA, vbTextCompare)
> > If j > 0 Then varAppt.Location = "0"
> > Next intI
> >
> > For intI = 58 To 126
> > varA = Chr(intI)
> > j = InStr(1, varAppt.Location, varA, vbTextCompare)
> > If j > 0 Then varAppt.Location = "0"
> > Next intI
> >
> > Is there a way to use one For loop instead of two?
> >
> > this does not work...
> >
> > For intI = 33 To 47, 58 To 126
> > varA = Chr(intI)
> > j = InStr(1, varAppt.Location, varA, vbTextCompare)
> > If j > 0 Then varAppt.Location = "0"
> > Next intI
> >
> > What I'm trying to do is make the string value varAppt.Location = "0" if
> > it's not a number.
> > as you know, the Ascii values for 0-9 are Chr(48) - (57)[/color]
>
> Look up the IsNumeric function in Help.
>
>
>
>
>[/color]


Closed Thread