PDA

View Full Version : Solved: Excel Function convert to access



Movian
08-24-2009, 05:13 AM
Hey,
just found this function designed for excel

http://www.vbaexpress.com/kb/getarticle.php?kb_id=285

im having a problem converting the line

sNum = left(sNum, Application.max(Len(sNum) - 3, 0))

more specifically

Application.max

What is the purpose of this ? and what would be an access equivalent.

Movian
08-24-2009, 08:29 PM
Well after much getting distracted from working on this i eventually came up with this

While Len(sNum) > 0
sHun = Right(sNum, 3)
If Len(sNum) > 3 Then
sNum = CInt(Mid(sNum, 1, Len(CStr(sNum)) - 3))
Else
sNum = ""
End If
If CInt(sHun) <> 0 Then
Result = Trim(Trim(HundredsToText(CVar(sHun)) & " " & TMBT(IC)) & " " & Result)
End If
IC = IC + 1
Wend