G
gjtired
I run the following code and I get this error: You must use the
dbSeeChanges option with OpenRecordset when accessing a SQL Server
table that has an IDENTITY column. (Error 3622) I’m putting in the
dbSeeChanges but I’m still getting the error. Please help
Dim sqlString As String
Dim db As Database
Dim qd As QueryDef
Dim rs As Recordset
Dim varSQL As String
Dim varRegID As Integer
Set db = CurrentDb
varRegID = [Forms]![frmRegistrationSel]![sbfrmRegistrationSelSub].Form!
[RegID]
sqlString = "SELECT tblCSP_Participant.CSPPart_ID,
tblCSP_Participant.RegID, tblCSP_Participant.BT_Youth,
tblCSP_Participant.P_F_Name , tblCSP_Participant.P_L_Name,
tblCSP_Participant.P_DOB," & _
"tblCSP_Participant.P_Gender, tblCSP_Participant.P_Relation_Child,
tblCSP_Participant.P_Language, tblCSP_Participant.P_Marital_Status,
tblCSP_Participant.P_Relation_Other_Adult,
tblCSP_Participant.S_F_Name, " & _
"tblCSP_Participant.S_L_Name, tblCSP_Participant.S_DOB,
tblCSP_Participant.S_Gender, tblCSP_Participant.S_Relation_Child,
tblCSP_Participant.S_Language, tblCSP_Participant.P_Y_F_Name, " & _
"tblCSP_Participant.P_Y_L_Name, tblCSP_Participant.P_Y_DOB,
tblCSP_Participant.P_Y_Gender, " & _
"tblCSP_Participant.Loc_Not_Home, tblCSP_Participant.Educ_Level,
tblCSP_Participant.School_Prog, " & _
"tblCSP_Participant.BTY_Program, tblCSP_Participant.FT_L_Name,
tblCSP_Participant.Community, " & _
"tblCSP_Participant.OY_F_Name1, tblCSP_Participant.OY_L_Name1,
tblCSP_Participant.OY_Age1, " & _
"tblCSP_Participant.OY_Gender1, tblCSP_Participant.OY_Home1,
tblCSP_Participant.OY_F_Name2, " & _
"tblCSP_Participant.OY_L_Name2, tblCSP_Participant.OY_Age2,
tblCSP_Participant.OY_Gender2, " & _
"tblCSP_Participant.OY_Home2, tblCSP_Participant.OY_F_Name3,
tblCSP_Participant.OY_L_Name3, " & _
"tblCSP_Participant.OY_Age3, tblCSP_Participant.OY_Gender3,
tblCSP_Participant.OY_Home3, " & _
"tblCSP_Participant.OY_F_Name4, tblCSP_Participant.OY_L_Name4,
tblCSP_Participant.OY_Age4, " & _
"tblCSP_Participant.OY_Gender4, tblCSP_Participant.OY_Home4,
tblCSP_Participant.OY_F_Name5, " & _
"tblCSP_Participant.OY_L_Name5, tblCSP_Participant.OY_Age5,
tblCSP_Participant.OY_Gender5, " & _
"tblCSP_Participant.OY_Home5, tblCSP_Participant.OY_F_Name6,
tblCSP_Participant.OY_L_Name6, " & _
"tblCSP_Participant.OY_Age6, tblCSP_Participant.OY_Gender6,
tblCSP_Participant.OY_Home6, " & _
"tblCSP_Participant.Case_F_Name, tblCSP_Participant.Case_L_Name,
tblCSP_Participant.Phone, " & _
"tblCSP_Participant.Edit_Date " & _
"from tblCSP_Participant " & _
"WHERE tblCSP_Participant.RegID=varRegID AND " & _
"tblCSP_Participant.Edit_Date =" & _
"( select Max(Edit_Date) " & _
" from tblCSP_Participant AS b " & _
"where b.RegID = tblCSP_Participant.RegID);"
Set rs = db.OpenRecordset(sqlString, , dbSeeChanges)
dbSeeChanges option with OpenRecordset when accessing a SQL Server
table that has an IDENTITY column. (Error 3622) I’m putting in the
dbSeeChanges but I’m still getting the error. Please help
Dim sqlString As String
Dim db As Database
Dim qd As QueryDef
Dim rs As Recordset
Dim varSQL As String
Dim varRegID As Integer
Set db = CurrentDb
varRegID = [Forms]![frmRegistrationSel]![sbfrmRegistrationSelSub].Form!
[RegID]
sqlString = "SELECT tblCSP_Participant.CSPPart_ID,
tblCSP_Participant.RegID, tblCSP_Participant.BT_Youth,
tblCSP_Participant.P_F_Name , tblCSP_Participant.P_L_Name,
tblCSP_Participant.P_DOB," & _
"tblCSP_Participant.P_Gender, tblCSP_Participant.P_Relation_Child,
tblCSP_Participant.P_Language, tblCSP_Participant.P_Marital_Status,
tblCSP_Participant.P_Relation_Other_Adult,
tblCSP_Participant.S_F_Name, " & _
"tblCSP_Participant.S_L_Name, tblCSP_Participant.S_DOB,
tblCSP_Participant.S_Gender, tblCSP_Participant.S_Relation_Child,
tblCSP_Participant.S_Language, tblCSP_Participant.P_Y_F_Name, " & _
"tblCSP_Participant.P_Y_L_Name, tblCSP_Participant.P_Y_DOB,
tblCSP_Participant.P_Y_Gender, " & _
"tblCSP_Participant.Loc_Not_Home, tblCSP_Participant.Educ_Level,
tblCSP_Participant.School_Prog, " & _
"tblCSP_Participant.BTY_Program, tblCSP_Participant.FT_L_Name,
tblCSP_Participant.Community, " & _
"tblCSP_Participant.OY_F_Name1, tblCSP_Participant.OY_L_Name1,
tblCSP_Participant.OY_Age1, " & _
"tblCSP_Participant.OY_Gender1, tblCSP_Participant.OY_Home1,
tblCSP_Participant.OY_F_Name2, " & _
"tblCSP_Participant.OY_L_Name2, tblCSP_Participant.OY_Age2,
tblCSP_Participant.OY_Gender2, " & _
"tblCSP_Participant.OY_Home2, tblCSP_Participant.OY_F_Name3,
tblCSP_Participant.OY_L_Name3, " & _
"tblCSP_Participant.OY_Age3, tblCSP_Participant.OY_Gender3,
tblCSP_Participant.OY_Home3, " & _
"tblCSP_Participant.OY_F_Name4, tblCSP_Participant.OY_L_Name4,
tblCSP_Participant.OY_Age4, " & _
"tblCSP_Participant.OY_Gender4, tblCSP_Participant.OY_Home4,
tblCSP_Participant.OY_F_Name5, " & _
"tblCSP_Participant.OY_L_Name5, tblCSP_Participant.OY_Age5,
tblCSP_Participant.OY_Gender5, " & _
"tblCSP_Participant.OY_Home5, tblCSP_Participant.OY_F_Name6,
tblCSP_Participant.OY_L_Name6, " & _
"tblCSP_Participant.OY_Age6, tblCSP_Participant.OY_Gender6,
tblCSP_Participant.OY_Home6, " & _
"tblCSP_Participant.Case_F_Name, tblCSP_Participant.Case_L_Name,
tblCSP_Participant.Phone, " & _
"tblCSP_Participant.Edit_Date " & _
"from tblCSP_Participant " & _
"WHERE tblCSP_Participant.RegID=varRegID AND " & _
"tblCSP_Participant.Edit_Date =" & _
"( select Max(Edit_Date) " & _
" from tblCSP_Participant AS b " & _
"where b.RegID = tblCSP_Participant.RegID);"
Set rs = db.OpenRecordset(sqlString, , dbSeeChanges)