Human_doing
Board Regular
- Joined
- Feb 16, 2011
- Messages
- 137
Hi all,
Can anyone please help with amending the below VBA, which at present hooks in to a SQL database and retreives all rows where frm_last_updated > 13/07/2011 00:00.
I'm looking to amend it so that it retrieves all rows where the frm_last_updated value is within the last 24 hours?
Thanks in advance for any help,
Can anyone please help with amending the below VBA, which at present hooks in to a SQL database and retreives all rows where frm_last_updated > 13/07/2011 00:00.
I'm looking to amend it so that it retrieves all rows where the frm_last_updated value is within the last 24 hours?
Thanks in advance for any help,
Code:
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=Sqlserver2;Description=SQLSERVER2;UID=audituser;;APP=Microsoft Office 2003;WSID=PCID1111 _
, Destination:=Range("A1"))
.CommandText = Array( _
"SELECT AuditData_AuditForm.frm_id, AuditData_AuditForm.frm_status, AuditData_AuditForm.frm_last_updated" & Chr(13) & "" & Chr(10) & "FROM SQLInfo.dbo.AuditData_AuditForm AuditData_AuditForm" & Chr(13) & "" & Chr(10) & "WHERE (AuditData_AuditForm.frm_last_u" _
, "pdated>={ts '2011-07-13 00:00:00'})")
.Name = "Query from Sqlserver2_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True