Hello there!
I am moving the backend of my access db to SQL Server and I found an issue that Im not able to solve. When I run this code:
When I try to get the PK from the first recordset on rs2![FK_User] always comes back empty. Before I moved to SQL Server, when the table was stored on the Access backend, this code used to work just fine.
There is anybody that knows why this is happening?
Thanks you all!
I am moving the backend of my access db to SQL Server and I found an issue that Im not able to solve. When I run this code:
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
Dim Form As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_users")
Dim fld As Field
datTimeCheck = Now()
rs.addnew
rs![U_Nom] = Me.txt_name
rs![U_Ape] = Me.txt_lastname
rs![U_Ini] = Me.txt_ini
rs![U_Sec] = Me.cbo_sect
rs![U_Act] = True
rs![U_Login] = Me.txt_user
rs![U_Gen] = Me.cbo_gen
rs![U_Perm] = Me.cbo_perm
Set rs2 = db.OpenRecordset("jn_hist_users")
rs2.addnew
rs2![FK_User] = rs![PK_User]
rs2![T_Dat] = Date
rs2![V_Dat] = "User has been added"
rs2![Ed_By] = GetUsername()
rs2![F_Now] = Now
rs2.Update
rs2.Close
rs.Update
rs.Close
db.Close
Set rs = Nothing
Set rs2 = Nothing
Set db = Nothing
When I try to get the PK from the first recordset on rs2![FK_User] always comes back empty. Before I moved to SQL Server, when the table was stored on the Access backend, this code used to work just fine.
There is anybody that knows why this is happening?
Thanks you all!