Set Focus to control on sub form

Derrick T. Davidson

Registered User.
Local time
Tomorrow, 05:29
Joined
Jan 31, 2016
Messages
15
Hi All
I have a form [frmTransaction] which contains a Sub Form [frmSubTransactionDetail] I have the form working great thanks to help here. However I have a new issue.
When I click on a control on the subform [Brand] if it is not in the list it opens the form [frmBrands] and I add the item and the category (I can't/don't want to just add it to the list as there is more than one entry per item).

Here is my problem when I close the form [frmBrands] I reopen the main form and go to the last record.

What I want to do is set the focus to control [txtCost] on the sub form when I try to do this
"set focus main form. set focus to sub form. set focus to control"

I get an error saying the form doesn't exist or is not open. From reading other posts I think that on open is to early is there a way to do this only for this event but not every time the form opens???
 
do it in your subform's (frmSubTransactionDetail) Load event:

private sub form_load()
Me.txtCost.SetFocus
end sub
 

Users who are viewing this thread

Back
Top Bottom