Insert five spaces in frnot of each records

Sandra Smith
Sandra Smith used Ask the Experts™
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 = ""

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")

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>"
       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>"
        strMailBody = "<Font Color=Blue>" & strMailBody & "</Font><br /><br />"
End With

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

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

    Set objOutMail = Nothing
    Set objOutApp = Nothing

End Sub

Open in new window

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
With rstHistory
    Do While Not .EOF
        strMailBody = strMailBody & "<br /><Font Color=Black>" & "-     " & ![Update] & "</Font>"
       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


Ah, SOOooooooo obvious.
Sandra SmithRetired


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




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