cwadams1955
Programmer
Hi, I'm working on a main form which will contain five embedded subforms (same form, just using different queries to return different subsets of data.) On these subforms, I need to set the default value (ideally in the OnOpen event of the mainform) to the value contained in a bound text box on the main form. Example: main form contains bound text box ProjectNo. When the form opens, I need to set the default value of a bound text box called ProjectNo on each of the subforms.
I can set the subforms' data source property with no problem; it queries the recordset perfectly and returns the correct data. But no matter what method I've used to try setting the default value of one of the controls on a subform, I get a runtime Error 438 (Object doesn't support this property or method .)
Here's the code I have right now:
where [Child1] is the name of the subform control on the main form. I've put this in the OnCurrent and the OnOpen event, and it throws the same error either place.
Searching has turned up several instances of this exact code offered as a solution to this type of scenario, but it's not working for me. Any ideas? Thanks for any assistance.
I can set the subforms' data source property with no problem; it queries the recordset perfectly and returns the correct data. But no matter what method I've used to try setting the default value of one of the controls on a subform, I get a runtime Error 438 (Object doesn't support this property or method .)
Here's the code I have right now:
Code:
Me![Child1].Form![ProjectNo].DefaultValue = "'" & Me![ProjectNo].Value & "'"
where [Child1] is the name of the subform control on the main form. I've put this in the OnCurrent and the OnOpen event, and it throws the same error either place.
Searching has turned up several instances of this exact code offered as a solution to this type of scenario, but it's not working for me. Any ideas? Thanks for any assistance.