Trying to run an sql update in vba. I don't get any errors, I've looked at the debug. print and the statement and values (where statement too) all look correct, but it is just not updating the record. This was working a few days ago, I might have changed something but I'm not aware of what.
code in form:
Code:
Private Sub txtDetWgt_AfterUpdate()
Dim dbCMC As DAO.Database
Dim strSQL As String
Dim datActSubDate As Date
Dim lngChgNum As Long
Dim datChgDate As Date
datChgDate = Date
datActSubDate = Date
Set dbCMC = CurrentDb
strSQL = "UPDATE dbo_tblSubmittals " & _
"SET [DetWgt] = " & Me.txtDetWgt.value & " And [ActSubDate] = #" & datActSubDate & "# " & _
"WHERE [JobNum] = '" & Me.cboJobNum.value & "' And [Segment] = '" & Me.cboSegment.value & "' And [Desc] = '" & Me.cboDesc.value & "'"
Debug.Print strSQL
dbCMC.Execute strSQL, dbFailOnError
End Sub
debug:
Code:
UPDATE dbo_tblSubmittals SET [DetWgt] = 31000 And [ActSubDate] = #4/21/2011# WHERE [JobNum] = '1123705000' And [Segment] = 'Sitework' And [Desc] = 'SITEWORK'
I checked the table about a million times, there's a record that has JobNum = 1123705000, Segment = "Sitework", and Desc = "Sitework" so there seems to be a match. I'm not sure why, if it wasn't updating, it wouldn't at least give me an error.