Insert five spaces in frnot of each records

Sandra Smith
Sandra Smith used Ask the Experts™
on
I need to have a five-space indent for each row in the eamil, but am not sure how to do this in HTML.  That is, for each row in the Historical and Current sections, they must start five spaces in from the left.
Public Sub GenerateEmail()
'Generates email to manager
Dim strUpdateTitle      As String
Dim strUpdateHistory    As String
Dim strUpdateCurrent    As String
Dim qdfUpdateHistory    As QueryDef
Dim qdfUpdateCurrent    As QueryDef
Dim strTaskID           As String
Dim strTaskTitle        As String
Dim rst                 As DAO.Recordset
Dim rstHistory          As DAO.Recordset
Dim rstCurrent          As DAO.Recordset
Dim objOutApp           As Object
Dim objOutMail          As Object
Dim strMailBody         As String
Dim strBodyAll          As String
Dim strEmailAddress     As String

strEmailAddress = "someaddress.com"

Set objOutApp = CreateObject("Outlook.Application")
Set objOutMail = objOutApp.CreateItem(0)

'First, need to get the TaskIDs for this week's updates
Set rst = CurrentDb.OpenRecordset("Select DISTINCT TaskID, TaskTitle FROM qryTasks_UpdatesEmail")
rst.MoveFirst

With rst
  Do While Not .EOF
If fntDoesObjectExist("qryUpdateHistory", "Query") Then DoCmd.DeleteObject acQuery, "qryUpdateHistory"
If fntDoesObjectExist("qryUpdateCurrent", "Query") Then DoCmd.DeleteObject acQuery, "qryUpdateCurrent"
strTaskID = rst!TaskID
strTaskTitle = rst!TaskTitle
'Start with task tile
strMailBody = "<b><Font Color=Black>" & strTaskTitle & "</Font></b>" & vbCrLf
'Next, list all the historical udpates for that task
Set qdfUpdateHistory = CurrentDb.CreateQueryDef("qryUpdateHistory", "SELECT Update " & _
                                         "FROM qryTasks_UpdatesEmailHistorical " & _
                                         "WHERE TaskID = '" & strTaskID & "' " & _
                                         "ORDER BY UpdateDate")
DoCmd.OpenQuery "qryUpdateHistory"
DoCmd.Close acQuery, "qryUpdateHistory"
Set rstHistory = CurrentDb.OpenRecordset("qryUpdateHistory", dbOpenForwardOnly)
With rstHistory
    Do While Not .EOF
        strMailBody = strMailBody & "<br /><Font Color=Black>" & "-" & ![Update] & "</Font>"
        .MoveNext
    Loop
       strMailBody = "<Font Color=Black>" & strMailBody & "</Font>"
End With
'Finally, get the most recent updates
Set qdfUpdateCurrent = CurrentDb.CreateQueryDef("qryUpdateCurrent", "SELECT Update " & _
                                        "FROM qryTasks_UpdatesEmail " & _
                                         "WHERE TaskID = '" & strTaskID & "' ORDER BY TimeStamp ")
DoCmd.OpenQuery "qryUpdateCurrent"
DoCmd.Close acQuery, "qryUpdateCurrent"
Set rstCurrent = CurrentDb.OpenRecordset("qryUpdateCurrent", dbOpenForwardOnly)
With rstCurrent
    Do While Not .EOF
        strMailBody = strMailBody & "<br />" & "<Font Color=Blue>" & "-" & ![Update] & "</Font>"
        .MoveNext
    Loop
        strMailBody = "<Font Color=Blue>" & strMailBody & "</Font><br /><br />"
End With

'Be sure to close old queries before re-using, just to clean up
    rstHistory.Close
    rstCurrent.Close
    Set rstHistory = Nothing
    Set rstCurrent = Nothing
'Go to next record in outside loop
    rst.MoveNext
    strBodyAll = strBodyAll & strMailBody
Loop
End With

    With objOutMail
        .To = strEmailAddress
        .Subject = "Weekly Updates " & Format(Date, "mm/dd/yyyy")
        .HTMLBody = strBodyAll
        .Display
    End With
    On Error GoTo 0

    Set objOutMail = Nothing
    Set objOutApp = Nothing

End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014
Commented:
With rstHistory
    Do While Not .EOF
        strMailBody = strMailBody & "<br /><Font Color=Black>" & "-     " & ![Update] & "</Font>"
        .MoveNext
    Loop
       strMailBody = "<Font Color=Black>" & strMailBody & "</Font>"
End With

Would the above work (i.e. just adding 5 spaces in front of the hyphen) or am I missing something.
Sandra SmithRetired

Author

Commented:
Ah, SOOooooooo obvious.
Sandra SmithRetired

Author

Commented:
Ok, jumped the gun on this one as I assumed it would work and guess what, nope.  Everything is still flush to the left.  I also did not make myself clear and my fault, the spaces must appear before the "-".
Sandra SmithRetired

Author

Commented:
AND THE ANSWER IS:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial