Hi,
This should give you some ideas:
Function AddingStringValues()
Dim str As String, neWstr As String
str = "The"
neWstr = UCase(str)
Dim iSum As Integer, i As Integer
iSum = 0
For i = 1 To Len(neWstr)
If Asc(Mid$(neWstr, i, 1)) >= 65 And Asc(Mid$(neWstr, i, 1))
<= 90 Then
iSum = iSum + Asc(Mid$(neWstr, i, 1)) - 64
End If
Next i
MsgBox iSum
End Function
As far as the number of occurrences of a letter you may want to the
function InStrRev (don't have any sample code on that though).
I hope this helps! If you have additional questions on this topic, please
respond back to this posting.
Regards,
Eric Butts
Microsoft Access Support
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<
http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <
http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."
--------------------
| Thread-Topic: change letter to number (A=1) then sum ie. cat=24
| thread-index: AcP2YlX2OmUooKNESsutcwanlJ0CPQ==
| X-Tomcat-NG: microsoft.public.access.queries
| From: "=?Utf-8?B?QWRhbQ==?=" <
[email protected]>
| Subject: change letter to number (A=1) then sum ie. cat=24
| Date: Wed, 18 Feb 2004 13:01:10 -0800
| Lines: 5
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.access.queries
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.queries:190362
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.access.queries
|
| I am trying to write a code where A=1, B=2, C=3 then add each letter
value to get a total.
for instance "cat" would be 3+1+20=24
I am trying to find way to return the number of occurances of a letter in a
field then multiply by the the set value. I was planning on doing this for
each letter in a query then adding them in another query which I would use
in a form. the result would be: I type in a word and it would return the
total value
|