Private Function UpdateCheckSum()
Dim recClone As Recordset
Dim CommaPos1 As Integer
Dim CommaPos2 As Integer
Dim AddNumbers As Integer
Set recClone = Me.RecordsetClone()
recClone.Bookmark = Me.Bookmark
strPosts = "," & recClone("comms1d") & ","
strPosts = strPosts & recClone("comms1n") & ","
recClone.Close
AddNumbers = 0
CommaPos1 = 0
CommaPos2 = 1
x = 0
While CommaPos2 <> 0
x = x + 1
CommaPos1 = InStr(CommaPos2, strPosts, ",")
CommaPos2 = InStr((CommaPos1 + 1), strPosts, ",")
If ((CommaPos2 - CommaPos1) <> 1) And (CommaPos2 <> 0) Then
AddNumbers = AddNumbers + CInt(Mid(strPosts, (CommaPos1 + 1), ((CommaPos2 - CommaPos1) - 1)))
End If
Wend
CheckSum = AddNumbers
End Function
Private Sub comms1d_LostFocus()
UpdateCheckSum
End Sub
Private Sub comms1n_LostFocus()
UpdateCheckSum
End Sub
Numbers are entered in the comms1d and comms1n textboxes seperated by commas. I need to do a checksum of all the numbers entered in both boxes and display the result in CheckSum.