1. Registered User
Join Date
Jun 2014
Posts
20

Hi sir...
Need help here...
I need function in ms access is below...

This formula used here in our area for land measurements.
K = Any number no limite for K
M= 20 (20 M is equal to 1 K)
S= 9 (9 S is equal to 1 M)
K, M and S
If S is greater than and equal to 9 then 1 add up in M
For example.
K (Kanal)=10
M (Marla)=12
S (Sarsai)=10 (S will be always <9 if it is 9 then 1 add up in M and M will be 13 and S will be 0)
M will be always <20 if it is 20 then 1 add up in K and K will be 11 and M will always be less than 20...

my Code is here:

Code:
```Public Function CalcVal(Kanal, Marla, Sarsai, pReturn As Byte) As Double
Static strVal As String
Static arrVal(1 To 3) As Double
Dim dblValue As Double

Kanal = CDbl("0" & Kanal)
Marla = CDbl("0" & Marla)
Sarsai = CDbl("0" & Sarsai)

If strVal <> Kanal & "/" & Marla & "/" & Sarsai Then
strVal = Kanal & "/" & Marla & "/" & Sarsai
While Sarsai >= 9
dblValue = Sarsai - 9
If dblValue > 9 Then dblValue = 9
Marla = Marla + 1
Sarsai = Sarsai - 9
Wend
While Marla >= 20
dblValue = Marla - 20
If dblValue > 20 Then dblValue = 20
Kanal = Kanal + 1
Marla = Marla - 21
Wend
arrVal(1) = Kanal
arrVal(2) = Marla
arrVal(3) = Sarsai
End If
CalcVal = arrVal(pReturn)
End Function```
(Conversions is table
call in query: SELECT Conversions.Kanal, Conversions.Marla, Conversions.Sarsai, CalcVal([Kanal],[Marla],[Sarsai],1) AS Value1, CalcVal([Kanal],[Marla],[Sarsai],2) AS Value2, CalcVal([Kanal],[Marla],[Sarsai],3) AS Value3
FROM Conversions;

2. Registered User
Join Date
Jun 2014
Posts
20
I have done... Thanks..... Just someone help me I want to sum up the calculated values in query but using the same function in sum as well...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•