'Write each row individually and add date in empty column

I have the following code in an Excel VBA module that looks up the ProjID named cell on the worksheet, selects columns needed for output from dbo_Proj_Dash Access table (and properly connects fields across multiple tables, where needed), then writes the entire recordset to the Excel sheet.

Dim AccessOutput As ADODB.Recordset
Set AccessOutput = New ADODB.Recordset
Dim SQLQuery As String

SQLQuery = "SELECT dbo_Proj_Dash.ID, dbo_Proj_Dash.Dash_Num, dbo_Proj_Dash.Dash_Desc, dbo_Proj_Dash_Type.Dash_Type, dbo_Proj_Dash.Dash_Qty, dbo_Proj_Dash.Dash_Unit, dbo_Proj_Dash_Mfr.MfrIni, dbo_Mng_Users.UserIni, dbo_Proj_Dash.Date_TargetSubmit, dbo_Proj_Dash.Date_ActualSubmit "
    SQLQuery = SQLQuery & ",dbo_Proj_Dash.Date_TargetApprove, dbo_Proj_Dash.Date_ActualApprove, dbo_Proj_Dash.Date_TargetRLSMfr, dbo_Proj_Dash.Date_ActualRlsMfr, dbo_Proj_Dash.Date_TargetShip, dbo_Proj_Dash.Date_ActualShip, dbo_Proj_Dash.Date_TargetInstallFinish, dbo_Proj_Dash.Date_ActualInstallFinish "
    SQLQuery = SQLQuery & ",dbo_Proj_Dash.Date_DashUpdate "
    SQLQuery = SQLQuery & "FROM ((dbo_Proj_Dash LEFT JOIN dbo_Proj_Dash_Type ON dbo_Proj_Dash.Dash_Type = dbo_Proj_Dash_Type.ID) LEFT JOIN dbo_Proj_Dash_Mfr ON dbo_Proj_Dash.Mfg = dbo_Proj_Dash_Mfr.ID) LEFT JOIN dbo_Mng_Users ON dbo_Proj_Dash.Dwg_Draftsman = dbo_Mng_Users.ID "
    SQLQuery = SQLQuery & "WHERE (((dbo_Proj_Dash.Proj_ID)= " & ProjID & " )) "
    SQLQuery = SQLQuery & "ORDER BY dbo_Proj_Dash.ID ASC"

          
AccessOutput.Open SQLQuery, DBConn, adOpenDynamic, adLockReadOnly

sht.Range("A4").CopyFromRecordset AccessOutput

I need help to rewrite this code so it writes each line individually. Additionally, I need to add code to, if available, write Date/Time from dbo_Proj_Dash.Date_DashUpdate to the Excel sheet for each line (should write to Column S/19); if unavailable, write the current Date/Time and trigger function LogActivity (which writes to a separate Access table/log, UserActivityLog).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source