Shinta
Registered User.
- Local time
- Today, 15:20
- Joined
- Jan 11, 2012
- Messages
- 48
Greetings dear Access Programmers fellows:
As the title says, I'm trying to set the DefaultValue of a ComboBox in a Continuous Form on the fly, based of the Value of another ComboBox in the MainForm. I'm trying the following code without the desired result:
Private Sub Form_Current()
Forms!MyForm!MySubForm!subFormCombo1.DefaultValue = Me.configComboBox 'Does nothing
Forms!MyForm!MySubForm!subFormCombo1.DefaultValue = "MyValue2" 'Does nothing
Forms!MyForm!MySubForm!subFormCombo1.DefaultValue = 2 'With numbers works perfectly, but I need to use text
Forms!MyForm!MySubForm!subFormCombo1.Requery
End Sub
I'm attaching an Access file which presents this scenario. Could you please give me a hand with this issue?
Btw, I don't want to use the solution in which I assign a DefaultValue at the DesignView -> ControlProperties, as in my real life scenario, I need it to be solved via VBA code as mentioned. Thanks.
Thanks a lot in advanced: I'm grateful with this forum, as I've always received the best of the supports around the web. Regards,
As the title says, I'm trying to set the DefaultValue of a ComboBox in a Continuous Form on the fly, based of the Value of another ComboBox in the MainForm. I'm trying the following code without the desired result:
Private Sub Form_Current()
Forms!MyForm!MySubForm!subFormCombo1.DefaultValue = Me.configComboBox 'Does nothing
Forms!MyForm!MySubForm!subFormCombo1.DefaultValue = "MyValue2" 'Does nothing
Forms!MyForm!MySubForm!subFormCombo1.DefaultValue = 2 'With numbers works perfectly, but I need to use text
Forms!MyForm!MySubForm!subFormCombo1.Requery
End Sub
I'm attaching an Access file which presents this scenario. Could you please give me a hand with this issue?
Btw, I don't want to use the solution in which I assign a DefaultValue at the DesignView -> ControlProperties, as in my real life scenario, I need it to be solved via VBA code as mentioned. Thanks.
Thanks a lot in advanced: I'm grateful with this forum, as I've always received the best of the supports around the web. Regards,