Forum Discussion
Tony2021
Nov 17, 2022Iron Contributor
Subform calling in StrSQL Insert Into
Hello Experts, I have an unbound form frmFXTracker. I have a subform on this form subfrmFXRollsChild I need to reference a field (IDRollsPK)in this subform but I am sure I have it wrong (bold) I ...
- Nov 18, 2022If [txtIDRollsPK] is the textbox (bound to IDRollsPK) on your subform:
strSQL = "INSERT INTO tblFXRollsChildHist (IDRollsPK, AmountRoll) VALUES (" & [subfrmFXRollsChild].[Form]![txtIDRollsPK] & "," & Me!AmountRoll & ")"
Harun24HR
Nov 18, 2022Bronze Contributor
Tony2021 You have to mention parent form name then use subform container. Try below-
strSQL = "INSERT INTO tblFXRollsChildHist (IDRollsPK, AmountRoll) VALUES (" & [ParentFormName]![subfrmFXRollsChild].[Form]![txtIDRollsPK]![IDRollsPK] & "," & Me!AmountRoll & ")"If above do not work then please attach a sample db file here.