If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
AddNew with Junction Table causing Grief?
Had some help with this, went and bought a book (which is still a bit greek
to me), and have played around some with the code. I have a main form with a subform within a subform that when the user clicks on a button, it will add a new record to another subform (with a subform inside that) I thought the best bet would be just to ignore those second subforms for now and get the one subform (well, table) to update to make sure that I actually get it right. I keep getting Runtime Error 2465 - Access can't recognize Record_ID. I think it's because I have a Junction Table for a many-to-many but I'm not sure how to allow for that? And it's entirely possible that I'm off-base with that assumption. Main Form: Frm_MAIN_AB (PK: Record_ID) Subform: Frm_Internal_Inspections (PK: IntInsp) I want to update Subtbl_Obligations_MAIN (PK: Oblig_ID) which is linked to the main table through TBL_JUNCTION (Record_ID and Oblig_ID). Could anyone tell me how I might fix this? Private Sub cmd_send_sd_ab_Click() Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb Set rs = db.OpenRecordset("Subtbl_Obligations_MAIN", dbOpenDynaset) rs.AddNew rs!Record_ID = Me!Record_ID -----HERE'S MY ERROR rs!Oblig_Date = Me!Frm_MAIN_AB!Frm_Internal_Inspections.Form!Int_I nsp_Date rs!Oblig_Date = Date rs!Oblig_Status = "Open" rs!Response_Due = Me!Frm_MAIN_AB!Frm_Internal_Inspections.Form!Respo nse_Due rs!Employee = Me!Frm_MAIN_AB!Frm_Internal_Inspections.Form!Emplo yee rs!Oblig_Type = "Self Declaration" rs!Int_Classification = "Yes" rs.Update rs.Close Set rs = Nothing End Sub Thank you!!!!!! |
#2
|
|||
|
|||
AddNew with Junction Table causing Grief?
Sorry I posted this to the wrong group - I will repost!
"carriey" wrote: Had some help with this, went and bought a book (which is still a bit greek to me), and have played around some with the code. I have a main form with a subform within a subform that when the user clicks on a button, it will add a new record to another subform (with a subform inside that) I thought the best bet would be just to ignore those second subforms for now and get the one subform (well, table) to update to make sure that I actually get it right. I keep getting Runtime Error 2465 - Access can't recognize Record_ID. I think it's because I have a Junction Table for a many-to-many but I'm not sure how to allow for that? And it's entirely possible that I'm off-base with that assumption. Main Form: Frm_MAIN_AB (PK: Record_ID) Subform: Frm_Internal_Inspections (PK: IntInsp) I want to update Subtbl_Obligations_MAIN (PK: Oblig_ID) which is linked to the main table through TBL_JUNCTION (Record_ID and Oblig_ID). Could anyone tell me how I might fix this? Private Sub cmd_send_sd_ab_Click() Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb Set rs = db.OpenRecordset("Subtbl_Obligations_MAIN", dbOpenDynaset) rs.AddNew rs!Record_ID = Me!Record_ID -----HERE'S MY ERROR rs!Oblig_Date = Me!Frm_MAIN_AB!Frm_Internal_Inspections.Form!Int_I nsp_Date rs!Oblig_Date = Date rs!Oblig_Status = "Open" rs!Response_Due = Me!Frm_MAIN_AB!Frm_Internal_Inspections.Form!Respo nse_Due rs!Employee = Me!Frm_MAIN_AB!Frm_Internal_Inspections.Form!Emplo yee rs!Oblig_Type = "Self Declaration" rs!Int_Classification = "Yes" rs.Update rs.Close Set rs = Nothing End Sub Thank you!!!!!! |
Thread Tools | |
Display Modes | |
|
|