PDA

View Full Version : VBA and SQL - help with update statement



jsabo
08-21-2013, 03:17 PM
Hello,

I am trying to get my VBA script to upload a date in a certain active cell (M1 for instance) to an Oracle database. NOTE: The date format i am going for is "DD/MM/YYYY"

Here is the SQL script in VBA that i currently have:


SQL_String = " UPDATE activities " & _
"SET ALOG_ACTUAL_DATE = " & _
ActiveSheet.Range("M" & i) & " WHERE " & _
"PO_SEQNO = " & ActiveSheet.Range("G" & i)


As is, i dont think it will wind up in SQL in "DD/MM/YYYY" format. Can anyone help to edit the above to fix that?

Thanks!

Kenneth Hobs
08-21-2013, 06:48 PM
Dates are numbers. If you want it in that format, you need to design your database to use that format. Use the Value property for a Range to get the date value.

IF you don't have a test database to try these things on, you may wind up with big problems.