G
gwoodby
While redoing this function, (not very good i might add) I found out
that it only has the subscript error say if served = vntX(5) was
empty, nothing was returned then it would give me the error, any way
to fix that? also, could you show me a better shorter way to write
this code jsut as an example..
Private Function SplitMe(strToSplit As String, intChoose As Integer)
Dim vntX As Variant
Dim First As String
Dim last As String
Dim mofa As String
Dim child As String
Dim issued As String
Dim served As String
vntX = Split(strToSplit, ",")
First = vntX(0)
last = vntX(1)
mofa = vntX(2)
child = vntX(3)
issued = vntX(4)
served = vntX(5)
If intChoose = 0 Then
SplitMe = First & "," & last
ElseIf intChoose = 1 Then
SplitMe = mofa
ElseIf intChoose = 2 Then
TxtFirstName = First
TxtLastName = last
CBOMoFa = mofa
TxtIssued = issued
TxtServed = served
SplitMe = First & "," & last
End If
End Function
that it only has the subscript error say if served = vntX(5) was
empty, nothing was returned then it would give me the error, any way
to fix that? also, could you show me a better shorter way to write
this code jsut as an example..
Private Function SplitMe(strToSplit As String, intChoose As Integer)
Dim vntX As Variant
Dim First As String
Dim last As String
Dim mofa As String
Dim child As String
Dim issued As String
Dim served As String
vntX = Split(strToSplit, ",")
First = vntX(0)
last = vntX(1)
mofa = vntX(2)
child = vntX(3)
issued = vntX(4)
served = vntX(5)
If intChoose = 0 Then
SplitMe = First & "," & last
ElseIf intChoose = 1 Then
SplitMe = mofa
ElseIf intChoose = 2 Then
TxtFirstName = First
TxtLastName = last
CBOMoFa = mofa
TxtIssued = issued
TxtServed = served
SplitMe = First & "," & last
End If
End Function