SETUP:
I am using a SQL Server database linked to a MS Access file so I can use Access forms.
I am using unbound forms with custom queries since I am dealing with several tables (If there is a more efficient way I am all for it).
In SQL Server I have setup a database role with permissions for the table, I have double checked that I have allowed the role to update the table.
ISSUE:
Whenever I use my update query in Access using a QueryDef (shown below) it runs successfully, but does not actually update the table.
DETAILS:
I was having an issue with my insert query as well, however that was only because I had not updated the query with new columns I had added in the database. I also made sure that I did the same for the update query.
Additionally I know that the update query works since I am able to update the entry directly from SSMS.
Since this seemed similar to another access/sql-server question I had, Found Here. I made sure to try the solution for that one, refreshing the table link. However, it made no difference.
CODE:
Query:
UPDATE con_people
SET people_first_name = @firstName,
people_last_name = @lastName,
people_title = @title,
people_group = @group,
people_email = @email,
people_shift = @shift,
people_hiredate = @hireDate,
people_location = @location,
people_reportsTo = @reportsTo,
people_versionCount = people_versionCount + 1,
people_datelastupdated = @dateUpdated,
people_isActive = @isActive
WHERE people_employeeID = @empID;
QueryDef:
Public Function UpdatePeople(firstName As String, _
lastName As String, _
title As Integer, _
group As Integer, _
Email As Variant, _
isActive As Boolean, _
Shift As Integer, _
Location As Integer, _
HireDate As Variant, _
ReportsTo As Variant, _
employeeID As Integer)
OtherFunctions.Initialize
Dim QDF As DAO.QueryDef
If FindQuery("UpdatePeople") = True Then OtherFunctions.dbs.QueryDefs.Delete "UpdatePeople"
Set QDF = OtherFunctions.dbs.CreateQueryDef("UpdatePeople", SQLUpdatePeople)
QDF.Parameters("@firstName").Value = firstName
QDF.Parameters("@lastName").Value = lastName
QDF.Parameters("@title").Value = title
QDF.Parameters("@group").Value = group
QDF.Parameters("@email").Value = Email
QDF.Parameters("@isActive").Value = isActive
QDF.Parameters("@empID").Value = employeeID
QDF.Parameters("@shift").Value = Shift
QDF.Parameters("@hireDate").Value = HireDate
QDF.Parameters("@location").Value = Location
QDF.Parameters("@reportsTo").Value = ReportsTo
QDF.Parameters("@dateUpdated").Value = ConvertTimeUnix.ConvertDateToUnix(Now())
QDF.Execute
If FindQuery("UpdatePeople") = True Then OtherFunctions.dbs.QueryDefs.Delete "UpdatePeople"
End Function
Any help is appreciated,
Thanks.