Hi all:
I've got one of those problems that I just can't get around, no matter what! In my code, I've got a SQL UPDATE like:
My parameters are created like this:
...and so on. In this table, fldERN is a foreign key that connects to it's primary key counterpart in another table - however for the purpose of this UPDATE, I'm only working with this table.
Now, when I run this code, it doesn't give me any errors. It's simply that nothing happens. I open up an existing record in the form, make a few changes, hit my save button...and the changes don't show up in the record. What's interesting though is that when I construct the WHERE clause using strings and comment out the .CreateParamete r lines for ERN and LeaveNum like this:
...it works fine! I just don't know why the statement won't work when I use parameters in the WHERE clause. Any insight? Thanks so much...
Pat
I've got one of those problems that I just can't get around, no matter what! In my code, I've got a SQL UPDATE like:
Code:
strSaveLeave = "UPDATE tblLeave SET fldLeaveType = @LeaveType, fldLeaveStatus = @LeaveStatus, fldDateLastWorked = @DateLastWorked, fldDateLeaveStart = @DateLeaveStart, fldDateLastPaid = @DateLastPaid, fldDateLeaveEnd = @DateLeaveEnd, fldDateWarningLetter = @DateWarningLetter, fldDateAWOLEmail = @DateAWOLEmail, fldDateReturnEmail = @DateReturnEmail, fldDateReturned = @DateReturned, fldLeaveNotes = @LeaveNotes WHERE tblLeave.fldLeaveNum = @LeaveNum AND tblLeave.fldERN = @ERN"
Code:
.Parameters.Append .CreateParameter("ERN", adBSTR, adParamInput, 7, currLeave.ERN)
.Parameters.Append .CreateParameter("LeaveNum", adInteger, adParamInput, , currLeave.LeaveNum)
.Parameters.Append .CreateParameter("LeaveType", adInteger, adParamInput, , currLeave.LeaveType)
Now, when I run this code, it doesn't give me any errors. It's simply that nothing happens. I open up an existing record in the form, make a few changes, hit my save button...and the changes don't show up in the record. What's interesting though is that when I construct the WHERE clause using strings and comment out the .CreateParamete r lines for ERN and LeaveNum like this:
Code:
WHERE tblLeave.fldERN = '" & currLeave.ERN & "' AND tblLeave.fldLeaveNum = " & currLeave.LeaveNum
Pat
Comment