showing text in email based on HTML script in VBA

SoxPats83

Registered User.
Local time
Today, 07:32
Joined
May 7, 2010
Messages
196
i have a form that generates emails and the end user has the option to select upto 20 "lines" to display in their email. problem is, the user may not be utilizing all 20 options and possibly only 1 or 2. what i would like is if the user selects any less than 20, than the remaining "Employee (Number field) @" is not displayed upto the 20 ocassion. i understand this is an odd request, but any help would be appreciated. thanks!
Code:
[FONT=Calibri].HTMLBody = "<HTML><Body><Head><H3><center><u>Today</u></center></H3></Head>" & “Employee” & " " & Me.Number & ":" & " " & " " & "@" & " " & Me.Location & " " & " " & Me.Job & "," & " " & Me.Notes & "<br>" & “Employee” & " " & Me.Number 01 & ":" & " " & " " & "@" & " " & Me.Location01 & " " & " " & Me.Job01 & "," & " " & Me.Notes01 & "</br><br>" & “Employee” & " " & Me.Number02 & ":" & " " & " " & "@" & " " & Me.Location02 & " " & " " & Me.Job02 & "," & " " & Me.Notes02 & "</br><br>" & “Employee” & " " & Me.Number03 & ":" & " " & " " & "@" & " " & Me.Location03 & " " & " " & Me.Job03 & "," & " " & Me.Notes03 & "</br><br>" & “Employee” & " " & Me.Number04 & ":" & " " & " " & "@" & " " & Me.Location04 & " " & " " & Me.Job04 & "," & " " & Me.Notes04 & "</br><br>" & “Employee” & " " & Me.Number05 & ":" & " " & " " & "@" & " " & Me.Location05 & " " & " " & Me.Job05 & "," & " " & Me.Notes05 & "</br><br>" & “Employee” & " " & Me.Number06 & ":" & " " & " " & "@" & " " & Me.Location06 & " " & " " & Me.Job06 & "," & " " & Me.Notes06 & "</br><br>" & “Employee” & " " & Me.Number07 & ":" & " " & " " & "@" & " " & Me.Location07 & " " & " " & Me.Job07 & "," & " " & Me.Notes07 & "</br><br>" & “Employee” & " " & Me.Number08 & ":" & " " & " " & "@" & " " & Me.Location08 & " " & " " & Me.Job08 & "," & " " & Me.Notes08 & "</br><br>" & “Employee” & " " & Me.Number09 & ":" & " " & " " & "@" & " " & Me.Location09 & " " & " " & Me.Job09 & "," & " " & Me.Notes09 & "</br><br>" & “Employee” & " " & Me.Number10 & ":" & " " & " " & "@" & " " & Me.Location10 & " " & " " & Me.Job10 & "," & " " & Me.Notes10 & "</br><br>" & “Employee” & " " & Me.Number11 & ":" & " " & " " & "@" & " " & Me.Location11 & " " & " " & Me.Job11 & "," & " " & Me.Notes11 & "</br><br>" & “Employee” & " " & Me.Number12 & ":" & " " & " " & "@" & " " & Me.Location12 & " " & " " & Me.Job12 & "," & " " & Me.Notes12 & "</br><br>" & “Employee” & " " & Me.Number13 & ":" & " " & " " & "@" & " " & Me.Location13 & " " & " " & Me.Job13 & "," & " " & Me.Notes13 & "</br><br>" & “Employee” & " " & Me.Number14 & ":" & " " & " " & "@" & " " & Me.Location14 & " " & " " & Me.Job14 & "," & " " & Me.Notes14 & "</br><br>" & “Employee” & " " & Me.Number15 & ":" & " " & " " & "@" & " " & Me.Location15 & " " & " " & Me.Job15 & "," & " " & Me.Notes15 & "</br><br>" & “Employee” & " " & Me.Number16 & ":" & " " & " " & "@" & " " & Me.Location16 & " " & " " & Me.Job16 & "," & " " & Me.Notes16 & "</br><br>" & “Employee” & " " & Me.Number17 & ":" & " " & " " & "@" & " " & Me.Location17 & " " & " " & Me.Job17 & "," & " " & Me.Notes17 & "</br><br>" & “Employee” & " " & Me.Number18 & ":" & " " & " " & "@" & " " & Me.Location18 & " " & " " & Me.Job18 & "," & " " & Me.Notes18 & "</br><br>" & “Employee” & " " & Me.Number19 & ":" & " " & " " & "@" & " " & Me.Location19 & " " & " " & Me.Job19 & "," & " " & Me.Notes19 & "</br></Body></HTML>"[/FONT]
 
Typically I would conditionally build a string:

Code:
If Len(Me.Location & vbNullString) > 0 Then 'they chose this
  strBody = strBody & "stuff here related to this choice"
End If
 

Users who are viewing this thread

Back
Top Bottom