G
Guest
I am trying to execute an SQL statement to create a record in tblVersion with foreign key = primary key in tblPeopl
I have the following code, I need to know how to execute the SQL (provided I created it correctly
I have 6 books and none of them address this
Dim lngPeoID As Integer 'holds newly created person ID for tblVersion and tblEva
Dim sSQL As String ' holds query to add the new person's first version recor
DoCmd.RunCommand acCmdSaveRecord 'saves person record so it's ID is create
'create records for tblVersion and tblEvaluatio
'DMax("[FieldName]", "TableName", Optional Criteria if needed
lngPeoID = DMax("[peoPeopleID]", "tblPeople"
'sSQL = "Insert Into tblb (<ForeignKeyFieldName>) Values (" & lngaID & ")
sSQL = "Insert into tblVersion (peoPeopleID Values (" & lngPeoID & ")
DoCmd.Requery sSQ
I have the following code, I need to know how to execute the SQL (provided I created it correctly
I have 6 books and none of them address this
Dim lngPeoID As Integer 'holds newly created person ID for tblVersion and tblEva
Dim sSQL As String ' holds query to add the new person's first version recor
DoCmd.RunCommand acCmdSaveRecord 'saves person record so it's ID is create
'create records for tblVersion and tblEvaluatio
'DMax("[FieldName]", "TableName", Optional Criteria if needed
lngPeoID = DMax("[peoPeopleID]", "tblPeople"
'sSQL = "Insert Into tblb (<ForeignKeyFieldName>) Values (" & lngaID & ")
sSQL = "Insert into tblVersion (peoPeopleID Values (" & lngPeoID & ")
DoCmd.Requery sSQ