nathan sanders said:
Brendan,
Thanks for looking at this. I have inserted the code you gave me into a
procedure and I am not getting any errors when I run it, however I am also
not getting the change made to the field. The code I have is below.
Case "DC AMERICAN EXPRESS "
strTrnval = Right(TXTDATA!field3, 6)
strfil1 = "amex"
MsgBox (strfil1)
CurrentDb.Execute "update tblSummary set fldAmexpaid = '" &
strTrnval & "' where fldDate = " & FILDATE
Case else
.
.
.
.
.
What's wrong here?
Nathan
Go back to Brendan's example, note the "dbFailOnError" option, and add it to
your code. You will then discover that there is an error in your SQL.
At a glance, it appears that you are handling a date field incorrectly.
Dates in Access SQL need to be delimited by "#" characters, thus:
CurrentDb.Execute "update tblSummary set fldAmexpaid = '" & strTrnval & "'
where fldDate = #" & FILDATE & "#"
Furthermore, dates need to be in American format i.e. mm/dd/yyyy. It looks
like you are a Kiwi and so, I believe, you are with the entire civilised
world in preferring dd/mm/yyyy. So, you are gonna have to reformat the
date, thus:
CurrentDb.Execute "update tblSummary set fldAmexpaid = '" & strTrnval & "'
where fldDate = #" & Format(FILDATE,"mm/dd/yyyy") & "#"