I am using Access 2000 to write info to a SQL server database
When I add a time like so
It shows up in the table as this
1/1/1900 7:00:00 AM
the Field type is "datetime"
here is the VBA ADO code:
==================================
Dim ThisTime As Date
Dim Conn As ADODB.Connection
Dim Rs1 As ADODB.Recordset
Dim SQLCode As String
Set Conn = New ADODB.Connection
Set Rs1 = New ADODB.Recordset
Conn.Open "driver=SQL Server;server=smallbserver;uid=sa;pwd=;database=Universal;"
ThisTime = "6:00am"
For a = 1 To 12
ThisTime = ThisTime + "1:00"
'Debug.Print ThisTime
SQLCode = "Insert Into [DailyEvents] (TimeON, DateON) Values ('" & ThisTime & "', '" & Format(DateNeeded, "mm/dd/yy"
& "')"
Rs1.Open SQLCode, Conn, adOpenStatic, adLockOptimistic
'Rs1.Close
Next
Set Rs1 = Nothing
Set Conn = Nothing
=========
Any Help would be appreciated DougP, MCP
Visit my WEB site to see how Bar-codes can help you be more productive
When I add a time like so
It shows up in the table as this
1/1/1900 7:00:00 AM
the Field type is "datetime"
here is the VBA ADO code:
==================================
Dim ThisTime As Date
Dim Conn As ADODB.Connection
Dim Rs1 As ADODB.Recordset
Dim SQLCode As String
Set Conn = New ADODB.Connection
Set Rs1 = New ADODB.Recordset
Conn.Open "driver=SQL Server;server=smallbserver;uid=sa;pwd=;database=Universal;"
ThisTime = "6:00am"
For a = 1 To 12
ThisTime = ThisTime + "1:00"
'Debug.Print ThisTime
SQLCode = "Insert Into [DailyEvents] (TimeON, DateON) Values ('" & ThisTime & "', '" & Format(DateNeeded, "mm/dd/yy"
Rs1.Open SQLCode, Conn, adOpenStatic, adLockOptimistic
'Rs1.Close
Next
Set Rs1 = Nothing
Set Conn = Nothing
=========
Any Help would be appreciated DougP, MCP
Visit my WEB site to see how Bar-codes can help you be more productive