Displaying Today's Date in VBA Select statement

irunergoiam

Registered User.
Local time
Yesterday, 23:03
Joined
May 30, 2009
Messages
76
I want the current date to display (see Date in Red below). I have tried the following, but can't seem to get it to work:

'#Date()#'
#'Date()'#
'#Date#'
#'Date'#

sSQL = " SELECT [LastName] & ', ' & [FirstName] & ' ' & [MiddleName] AS [FullName], [1STARTRequestLog].[LastName] & ', ' & [1STARTRequestLog].[FirstName] & ' - ' & [1STARTRequestLog].System & ' - ' & #Date# AS [START Subject]," & _

Any ideas??? I get a "Runtime Error '13': Type Mismatch" error.

Thanks in advance for your guidance on this.
 
For the date formula you don't need to use the octothorpes.

Just:

sSQL = " SELECT [LastName] & ', ' & [FirstName] & ' ' & [MiddleName] AS [FullName], [1STARTRequestLog].[LastName] & ', ' & [1STARTRequestLog].[FirstName] & ' - ' & [1STARTRequestLog].System & ' - ' & Date() AS [START Subject]," & _

should do the trick
 

Users who are viewing this thread

Back
Top Bottom