If all you're trying to do is retrieve the value, why are you moving focus?
In Access, you can only use the .Text property if the control has focus, but
you can use the .Value property anytime.
And I'm not sure what you're trying to do with:
Subtotal.Text =
Forms!FrmInvoiceMain!frmInvoiceDetailsSub.Form!TxtTotNettPrice.SetFocus
All you should need is:
Private Sub CmdCalc_Click()
Me.Subtotal =
Forms!FrmInvoiceMain!frmInvoiceDetailsSub.Form!TxtTotNettPrice
End Sub
In answer to your question, though, in order to set focus to a control on a
subform, you first need to set focus to the subform control itself. In other
words, you'd need
Forms!FrmInvoiceMain!frmInvoiceDetailsSub.SetFocus
Forms!FrmInvoiceMain!frmInvoiceDetailsSub.Form!TxtTotNettPrice.SetFocus
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
J Schoeman said:
I have used the following code
Private Sub CmdCalc_Click()
Forms!FrmInvoiceMain!frmInvoiceDetailsSub.Form!TxtTotNettPrice.SetFocus
Subtotal.Text =
Forms!FrmInvoiceMain!frmInvoiceDetailsSub.Form!TxtTotNettPrice.SetFocus
End Sub
Now it returns the error
"Microsoft Access can't move the focus tot the control TxTTotNettPrice
Allen Browne said:
See:
Referring to Controls on a Subform
at:
http://allenbrowne.com/casu-04.html
The reference will be something like:
Forms![YourMainForm]![YourSubformControl].Form![YourControl]
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
J Schoeman said:
I have an unbound textbox control on a subform in the form footer. In
this
control I use the Sum function to dispaly the total of the values in
the
subform's Detail area. The Subform (datasheet view) is then placed on
the
Main form. Now I want to retrieve the value from the subforms control
to
do
calculations with is value in the main form's controls. Please can you
assist
me with this. I am working on MS Access 2003