Stuck At Code That Read Value From Given Array

Ashfaque

Search Beautiful Girls from your town for night
Local time
Tomorrow, 03:57
Joined
Sep 6, 2004
Messages
897
Hi,

I am trying read value xTStr mentioned in my array for all 2 digits. (This is extended part of my 'convert Number to URDU words db')

Means when xTStr have 2 digit value from 10 to 99 only (which is surely generated from other function), it should read the relevant value form given array to read the text. I have covered to read value from 1 to 9 is perfectly working. Only what I need to read the relevant value of 2 digits from the given 1 to 100 (array).

I tried but stuck up here UrduRupeeFormat_GetT = xTStr

Can someone help me please

Code:
Function UrduRupeeFormat_GetT(xTStr As String)
    Dim xTArr1(100) As Variant
        
    Dim xRStr As String
        xRStr = xRStr & UrduRupeeFormat_GetD(Right(xTStr, 1))

xTArr1(1) = " Çí˜"
xTArr1(2) = " Ïæ"
xTArr1(3) = " Êíä"
xTArr1(4) = " ÇÑ"
xTArr1(5) = " Çä"
xTArr1(6) = " ª"
xTArr1(7) = " ÓÇÊ"
xTArr1(8) = " Šª"
xTArr1(9) = " äæ"
xTArr1(10) = " ÏÓ"
xTArr1(11) = " íÇÑÀ "
xTArr1(12) = " ÈÇÑÀ"
xTArr1(13) = " ÊíÑÀ"
xTArr1(14) = " æÏÀ "
xTArr1(15) = " äÏÑÀ "
xTArr1(16) = " ÓæáÀ"
xTArr1(17) = " ÓÊÑÀ"
xTArr1(18) = " ÇŠªÇÑÀ"
xTArr1(19) = " ÇäíÓ"
xTArr1(20) = " ÈíÓ"
xTArr1(21) = " ǘíÓ"
xTArr1(22) = " ÈÇÆíÓ"
xTArr1(23) = " ÊÆíÓ"
xTArr1(24) = "æÈíÓ"
xTArr1(25) = " íÓ"
xTArr1(26) = " ÀÈíÓ"
xTArr1(27) = " ÓÊÇÆíÓ"
xTArr1(28) = " ÇŠªÇÆíÓ"
xTArr1(29) = " ÇäÊíÓ"
xTArr1(30) = " ÊíÓ"
xTArr1(31) = " ǘÊíÓ"
xTArr1(32) = " ÈÊíÓ"
xTArr1(33) = " ÊíäÊíÓ"
xTArr1(34) = " æäÊíÓ"
xTArr1(35) = " íäÊÓ"
xTArr1(36) = " ªÊíÓ"
xTArr1(37) = " ÓíäÊíÓ"
xTArr1(38) = " ÇšÊíÓ"
xTArr1(39) = " ÇäÊÇáíÓ"
xTArr1(40) = " ÇáíÓ"
xTArr1(41) = " ǘÊÇáíÓ"
xTArr1(42) = " ÈíÇáíÓ"
xTArr1(43) = " ÊíäÊÇáíÓ"
xTArr1(44) = " æÇáíÓ"
xTArr1(45) = " íäÊÇáÓ"
xTArr1(46) = " ªíÇáíÓ"
xTArr1(47) = " ÓíäÊÇáíÓ"
xTArr1(48) = " ÇšÊÇáíÓ"
xTArr1(49) = " ÇäÇÓ"
xTArr1(50) = " ÇÓ"
xTArr1(51) = " ǘíÇæä"
xTArr1(52) = " ÈÇæä"
xTArr1(53) = " ÊÑä"
xTArr1(54) = " æä"
xTArr1(55) = " ä"
xTArr1(56) = " ªä"
xTArr1(57) = " ÓÊÇæä"
xTArr1(58) = " ÇŠªÇæä"
xTArr1(59) = " ÇäÓŠª"
xTArr1(60) = " ÓÇŠª"
xTArr1(61) = " ǘӊª"
xTArr1(62) = " ÈÇÓŠª"
xTArr1(63) = " ÊÑíÓŠª"
xTArr1(64) = " æäÓŠª"
xTArr1(65) = " íäÓŠª"
xTArr1(66) = " ªíÇÓŠª"
xTArr1(67) = " ÓšÓŠª"
xTArr1(68) = " ÇšÓŠª"
xTArr1(69) = " ÇäÀÊÑ"
xTArr1(70) = " ÓÊÑ"
xTArr1(71) = " ǘÀÊÑ"
xTArr1(72) = " ÈÀÊÑ"
xTArr1(73) = " ÊÀÊÑ"
xTArr1(74) = " æÀÊÑ"
xTArr1(75) = " ªÊÑ"
xTArr1(76) = " ªÀÊÑ"
xTArr1(77) = " ÓÊÊÑ"
xTArr1(78) = " ÇŠªÀÊÑ"
xTArr1(79) = " ÇäÇÓí"
xTArr1(80) = " ÇÓí"
xTArr1(81) = " ǘíÇÓí"
xTArr1(82) = " ÈíÇÓí"
xTArr1(83) = " ÊÑÇÓí"
xTArr1(84) = " æÑÇÓí"
xTArr1(85) = " ÇÓí"
xTArr1(86) = " ªíÇÓí"
xTArr1(87) = " ÓÊÇÓí"
xTArr1(88) = " ÇŠªÇÓí"
xTArr1(89) = " äæÇÓí"
xTArr1(90) = " äæÿ"
xTArr1(91) = " ǘíÇäæÿ"
xTArr1(92) = " ÈÇäæÿ"
xTArr1(93) = " ÊÑÇäæÿ"
xTArr1(94) = " æÑÇäæÿ"
xTArr1(95) = " Çäæÿ"
xTArr1(96) = " ªíÇäæÿ"
xTArr1(97) = " ÓÊÇäæÿ"
xTArr1(98) = " ÇŠªÇäæÿ"
xTArr1(99) = " ääÇäæÿ"
xTArr1(100) = " Çí˜ Óæ"

      UrduRupeeFormat_GetT = xTStr
End Function
 
If xTStr is a number from 0 - 100 not including the leading zero the simply use

Val(xTStr)

to give you the array look up value?
 
Its Text. Not numerical value. I need it to pick the text relevant to xTStr

Means if xTStr is 62 so it should read xTArr1(62) = " ÈÇÓŠª"

in any variable. I tried with select case but didnt work properly. Something was wrong in loop so I removed that loop.
 
Do not use the. Right function then?
 
What I suggested was to use the Val() function to convert your text string to the number the Array is looking for.

Dim xRStr As String
xRStr = xRStr & UrduRupeeFormat_GetD(Val(xTStr))

This avoids needing to know how long it is.
 
Dim xTArr1(100) As Variant
you'll have problem with the above you did not mention Option Base 1.

you should use

Dim xTArr(1 To 100) As Variant

///
you are only reading the Right$(xTStr, 1), which is 1 digit.

you must create a function that will read xTStr, backward to extract
All numbers:

Public Function fncRightNums(byval pString As String) As Integer
Dim sResult As String
Dim ln As Long, i As Long
Dim tmp As String
ln = Len(pString & vbNullString)
If ln < 1 Then Exit Function
For i = ln To 1 Step -1
tmp = Mid$(pString, i, 1)
If IsNumeric(tmp) Then
sResult = tmp & sResult
Else
Exit For
End If
fncRightNums = Val(sResult)
End Function
 
Not that I question your choice, but have you considered making a one-time table of 100 entries in a table with two fields: <number, string> ?
Then a DLookup would work. But better still, if you wanted to do this lookup as part of a query, you could do the lookup based on a numerical JOIN, which would be much faster.
 

Users who are viewing this thread

Back
Top Bottom