topdesk123
Programmer
Hello all!
This is a sample of the code I'm using to produce a sentence that includes the items that customer's order. The first line will change depending on the order as well. I just need to know how to keep it from inserting a comma before the first item.
My thanks to Cajun Centurion for this solution months ago!
TIA!
Dim lCol_IncludeAreas As New Collection
Dim lStr_FullSent As String
Dim lInt_Idx As Integer
If (Me![Sealer] = True) Then
lCol_IncludeAreas.Add "Company will do this "
End If
If (Me![item1] = True) Then
lCol_IncludeAreas.Add "item1sentence"
End If
If (Me![item2] = True) Then
lCol_IncludeAreas.Add "item2sentence"
End If
If (Me![item3] = True) Then
lCol_IncludeAreas.Add "item3sentence"
End If
Select Case lCol_IncludeAreas.Count
Case 0
lStr_FullSent = vbNullString
Case 1
lStr_FullSent = lCol_IncludeAreas.Item(1)
Case 2
lStr_FullSent = lCol_IncludeAreas.Item(1) & " and " & lCol_IncludeAreas.Item(2)
Case Else
lStr_FullSent = vbNullString
For lInt_Idx = 1 To lCol_IncludeAreas.Count - 1
lStr_FullSent = lStr_FullSent & lCol_IncludeAreas.Item(lInt_Idx) & ", "
Next lInt_Idx
lStr_FullSent = lStr_FullSent & "and " & lCol_IncludeAreas.Item(lCol_IncludeAreas.Count)
End Select
Me![Sentence] = "" & lStr_FullSent & " for " & (FormatCurrency(Forms![bid sheet]![ActItem]) & ". ")
Exit_Command59_Click:
Exit Sub
Err_Command59_Click:
MsgBox Err.Description
Resume Exit_Command59_Click
End Sub
This is a sample of the code I'm using to produce a sentence that includes the items that customer's order. The first line will change depending on the order as well. I just need to know how to keep it from inserting a comma before the first item.
My thanks to Cajun Centurion for this solution months ago!
TIA!
Dim lCol_IncludeAreas As New Collection
Dim lStr_FullSent As String
Dim lInt_Idx As Integer
If (Me![Sealer] = True) Then
lCol_IncludeAreas.Add "Company will do this "
End If
If (Me![item1] = True) Then
lCol_IncludeAreas.Add "item1sentence"
End If
If (Me![item2] = True) Then
lCol_IncludeAreas.Add "item2sentence"
End If
If (Me![item3] = True) Then
lCol_IncludeAreas.Add "item3sentence"
End If
Select Case lCol_IncludeAreas.Count
Case 0
lStr_FullSent = vbNullString
Case 1
lStr_FullSent = lCol_IncludeAreas.Item(1)
Case 2
lStr_FullSent = lCol_IncludeAreas.Item(1) & " and " & lCol_IncludeAreas.Item(2)
Case Else
lStr_FullSent = vbNullString
For lInt_Idx = 1 To lCol_IncludeAreas.Count - 1
lStr_FullSent = lStr_FullSent & lCol_IncludeAreas.Item(lInt_Idx) & ", "
Next lInt_Idx
lStr_FullSent = lStr_FullSent & "and " & lCol_IncludeAreas.Item(lCol_IncludeAreas.Count)
End Select
Me![Sentence] = "" & lStr_FullSent & " for " & (FormatCurrency(Forms![bid sheet]![ActItem]) & ". ")
Exit_Command59_Click:
Exit Sub
Err_Command59_Click:
MsgBox Err.Description
Resume Exit_Command59_Click
End Sub