A
AkAlan via AccessMonster.com
I need a date insererted in the ESR_OPEN_DATE column when I run this code
but I get 12:00 AM instead. The variable is loaded with a valid date. I have
tried every kind of formatting and syntax alteration I can think of and found
posted but I cannot get this to work. I am going to spend all weekend working
this so if anyone can help, please do. I suppose the time field will be an
issue once I can get the date to work so if there is a difference between how
to format a date and a time please show both.
Thanks to all that reply, you guys are great!!. I'm hoping that I can start
answering some of these posts myself someday soon. Just getting started using
SQL from Access.
strJcn = "'" & NextJCN() & "'"
strParcTag = "'" & Me.cboEquipID.Column(0) & "'"
strPerfWc = "'" & Me.cboPWC & "'"
strRptby = "'" & Me.cboReportedBy.Column(0) & "'"
strDisc = "'" & Me.txtDisc & "'"
datOpenDate = Me.txtOpenDate
datOpenTime = Me.txtOpenTime
intCond = Me.cboCond
intStatus = Me.cboStatus
intAction = Nz(Me.cboActionTaken, 0)
strSQL = "INSERT INTO ESR (ESR_JCN,ESR_PARCTAG,ESR_DISC,ESR_RPTBY,
ESR_OPEN_DATE)" _
& " VALUES (" & strJcn & "," & strParcTag & "," & strDisc & "" _
& "," & strRptby & "," & datOpenDate & ")"
DoCmd.RunSQL strSQL
but I get 12:00 AM instead. The variable is loaded with a valid date. I have
tried every kind of formatting and syntax alteration I can think of and found
posted but I cannot get this to work. I am going to spend all weekend working
this so if anyone can help, please do. I suppose the time field will be an
issue once I can get the date to work so if there is a difference between how
to format a date and a time please show both.
Thanks to all that reply, you guys are great!!. I'm hoping that I can start
answering some of these posts myself someday soon. Just getting started using
SQL from Access.
strJcn = "'" & NextJCN() & "'"
strParcTag = "'" & Me.cboEquipID.Column(0) & "'"
strPerfWc = "'" & Me.cboPWC & "'"
strRptby = "'" & Me.cboReportedBy.Column(0) & "'"
strDisc = "'" & Me.txtDisc & "'"
datOpenDate = Me.txtOpenDate
datOpenTime = Me.txtOpenTime
intCond = Me.cboCond
intStatus = Me.cboStatus
intAction = Nz(Me.cboActionTaken, 0)
strSQL = "INSERT INTO ESR (ESR_JCN,ESR_PARCTAG,ESR_DISC,ESR_RPTBY,
ESR_OPEN_DATE)" _
& " VALUES (" & strJcn & "," & strParcTag & "," & strDisc & "" _
& "," & strRptby & "," & datOpenDate & ")"
DoCmd.RunSQL strSQL