leecey5225
New member
- Local time
- Today, 09:07
- Joined
- Feb 22, 2017
- Messages
- 2
Hi,
I am trying to default a set of values into the header records of a subform based on values passed from the previous mainform. I have tried a large number of variations on a theme, but this is what I have as the latest. All I get in the form is #NAME? Any ideas please - I am new to VBA!
=[Forms]![CprLessonsLearned]![LL_CPRID].[DefaultValue]=DLookUp([CPR.CPRID],[CPR],"[LL_CPRID] = " & [Forms]![MainForm]![Detail]![CprId])
CprLessonsLearned is the subform, with LL_CPRID the name of the form field. I need this to always default to the CprId in the Mainform so it doesn't get wiped everytime I create a new record (which is why I'm doing this in the first place)
I am trying to default a set of values into the header records of a subform based on values passed from the previous mainform. I have tried a large number of variations on a theme, but this is what I have as the latest. All I get in the form is #NAME? Any ideas please - I am new to VBA!
=[Forms]![CprLessonsLearned]![LL_CPRID].[DefaultValue]=DLookUp([CPR.CPRID],[CPR],"[LL_CPRID] = " & [Forms]![MainForm]![Detail]![CprId])
CprLessonsLearned is the subform, with LL_CPRID the name of the form field. I need this to always default to the CprId in the Mainform so it doesn't get wiped everytime I create a new record (which is why I'm doing this in the first place)