I have a simple dropdown box with account status's (shipped, cancelled, etc..). Once a status is selected I have some code fire to update dates/fields in other tables. My problem is the "Date" expression is writing a time to my table..see below:
Private Sub Status_AfterUpdate()
Dim sSQL$, iCustID As Double
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
iCustID = Val(CustomerID)
Select Case UCase(Status)
Case "SHIPPED"
sSQL = "UPDATE ztblPhysicianInfo SET ShippedDate = " & Date & " WHERE CustomerID = " & iCustID
Case "INACTIVE"
sSQL = "UPDATE ztblRespInfo SET TRACK = 0, FINISHED = -1 WHERE CustomerID = " & iCustID
End Select
MsgBox sSQL
rs.Open sSQL, CurrentProject.Connection
Form_Current
End Sub
The msgbox shows SQL statement with the correct date displayed (ie. 7/16/2004). But, once the statement writes it is writing this value to my date field: 12:00:19 AM. It doesn't matter what time or day it is that is the only value it writes to the table.
Now I can replace the Date variable and hard code a date in the update statement and that works fine. What is going on?
Database Info:
MS Access 2k
ShippedDate field has a data type of Date/Time
Private Sub Status_AfterUpdate()
Dim sSQL$, iCustID As Double
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
iCustID = Val(CustomerID)
Select Case UCase(Status)
Case "SHIPPED"
sSQL = "UPDATE ztblPhysicianInfo SET ShippedDate = " & Date & " WHERE CustomerID = " & iCustID
Case "INACTIVE"
sSQL = "UPDATE ztblRespInfo SET TRACK = 0, FINISHED = -1 WHERE CustomerID = " & iCustID
End Select
MsgBox sSQL
rs.Open sSQL, CurrentProject.Connection
Form_Current
End Sub
The msgbox shows SQL statement with the correct date displayed (ie. 7/16/2004). But, once the statement writes it is writing this value to my date field: 12:00:19 AM. It doesn't matter what time or day it is that is the only value it writes to the table.
Now I can replace the Date variable and hard code a date in the update statement and that works fine. What is going on?
Database Info:
MS Access 2k
ShippedDate field has a data type of Date/Time