D
David Marks
When clicking on a choice in a list box, I want to set a field in a subform
equal to a value from a DLookUp. Depending on the choice made, the field in
which I store the data will be different. strGroup will be the name of the
field in the Subform: DxTxCreatedSubForm into which I want to store the data.
I first have
Dim strGroup as String
strGroup = DLookup("Group1", "DxGroup", "DxGroupID = forms!Main!Group1") &
"_1_Short"
When I Msgbox strGroup, the name of the field to store the data pops up
correctly. I just need the code to specify that field in the subform.I tried
Forms!Main!DxTxCreatedsubform.Form! & ("strGroup") = DLookup("Choice",
"DxChoices", "DxChoicesID = Forms!Main!Choice")
I also tried:
Forms!Main!DxTxCreatedsubform.Form!("strGroup") = DLookup("Choice",
"DxChoices", "DxChoicesID = Forms!Main!Choice")
and:
Forms!Main!DxTxCreatedsubform.Form!"strGroup" = DLookup("Choice",
"DxChoices", "DxChoicesID = Forms!Main!Choice")
and I tried:
Forms!Main!DxTxCreatedsubform.Form!strGroup = DLookup("Choice", "DxChoices",
"DxChoicesID = Forms!Main!Choice")
None of these options liked how I specified strGroup as the field name in
the subform. Each time, I got an error message.
Is there a way to correctly write this line of code?
Thanks,
David
equal to a value from a DLookUp. Depending on the choice made, the field in
which I store the data will be different. strGroup will be the name of the
field in the Subform: DxTxCreatedSubForm into which I want to store the data.
I first have
Dim strGroup as String
strGroup = DLookup("Group1", "DxGroup", "DxGroupID = forms!Main!Group1") &
"_1_Short"
When I Msgbox strGroup, the name of the field to store the data pops up
correctly. I just need the code to specify that field in the subform.I tried
Forms!Main!DxTxCreatedsubform.Form! & ("strGroup") = DLookup("Choice",
"DxChoices", "DxChoicesID = Forms!Main!Choice")
I also tried:
Forms!Main!DxTxCreatedsubform.Form!("strGroup") = DLookup("Choice",
"DxChoices", "DxChoicesID = Forms!Main!Choice")
and:
Forms!Main!DxTxCreatedsubform.Form!"strGroup" = DLookup("Choice",
"DxChoices", "DxChoicesID = Forms!Main!Choice")
and I tried:
Forms!Main!DxTxCreatedsubform.Form!strGroup = DLookup("Choice", "DxChoices",
"DxChoicesID = Forms!Main!Choice")
None of these options liked how I specified strGroup as the field name in
the subform. Each time, I got an error message.
Is there a way to correctly write this line of code?
Thanks,
David