I'm using a SQL query in VBA to select and join data spread across two worksheets and then outputting the results to a third worksheet. One of the fields is an Excel Date.
On the source worksheet the value is: 9/25/2008 21:05
On the output worksheet the result is: 38996.402222
I would like the output to also be formatted: MM/DD/YYYY HH:MM
I read a reference to "DateAdd" somewhere... So i tried the following, but I do not receive any results.
Thoughts/ guidance?
I would prefer to perform the formatting as part of the SQL query, rather than trying to capture the result during output. For now i just write out the entire table of results to the output sheet.
Thanks,
Dave
On the source worksheet the value is: 9/25/2008 21:05
On the output worksheet the result is: 38996.402222
I would like the output to also be formatted: MM/DD/YYYY HH:MM
I read a reference to "DateAdd" somewhere... So i tried the following, but I do not receive any results.
Code:
stSQL = "SELECT [Worksheet1$].[Last Updated Date], DateAdd([Worksheet1$].[Last Updated Date], -2, 39083) FROM [Worksheet1$]"
I would prefer to perform the formatting as part of the SQL query, rather than trying to capture the result during output. For now i just write out the entire table of results to the output sheet.
Thanks,
Dave