Can’t easily test this so please take it with a grain of salt.
You did not say which line of code raises the error.
If it’s the first line of code that raises the error then…
This line of code is probably not required.
DoCmd.SelectObject acForm, "FrmOrderInfoMain"
Don’t know what it does because I’ve never had to use it.
If it’s the second line of code that raises the error then…
Just as a start the Forms collection is plural: -
Form!FrmOrderInfoMain.Form!SubFrmOrderInfo!txtItemDesc = strItemDesc
!FrmOrderInfoMain.Form!SubFrmOrderInfo!txtItemDesc = strItemDesc
But I doubt if that will fix it because FrmOrderInfoMain does not have a Form property so: -
should be incorrect.
Forms!FrmOrderInfoMain!SubFrmOrderInfo!txtItemDesc = strItemDesc
That should still be incorrect because SubFrmOrderInfo is a Form container and does not have a control named txtItemDesc.
It is the Form in the SubForm container that has the control txtItemDesc.
Therefore it looks like it should be: -
Forms!FrmOrderInfoMain!SubFrmOrderInfo!Form!txtItemDesc = strItemDesc
But this is ‘airware’ because I seldom use the bang (!) and prefer the dot (.)
(And I don’t use the code that ‘build’ might create.)
Here is a link to the subject…http://www.advisor.com/Articles.nsf/aid/BAROA06
The way I read that article is… Dot(.) when you can and Bang(!) when you can’t.
I don’t go that far but use the Dot(.) for properties and the Bang(!) for field references.
I think it’s mostly a personal preference but the consistent use of a preference yields dividends.
Hope that helps.