setfocus to subform

geno

Registered User.
Local time
Today, 06:59
Joined
Jun 19, 2000
Messages
243
Hi, I have a form with a subform, when the user enters into the subform, unitprice field, I have another form open with pricing info on the product. I would like to have the focus go from the pricing info form back to the unitprice field on the subform. I found this code on this forum but I can't seem to get it to work.

Forms![Orders]![order details subform].Form![unitprice].setfocus

The pricing info form still holds the focus.
Thanks
 
Is the Pricing form Modal property set to yes? If so, this form won't let anything else take the focus while it's open. Leave the pop-up property to yes but set modal to no.
 
These setting are already set to what you suggested. Any other ideas?
 
Hi, I still can't get this to work and it's about the last thing that I have to do before rolling out this database. I've searched this site and others but no luck on getting this to work. Can anyone help.....Thanks
 
I'm guessing that Rich's code needs to be put in the On Open event of the pop-up form.
 
That's where I do have it, but nothing happens when the pop up form opens. The pop up form still has focus.
 
How do you exit from the price info form. A button maybe, anyway, not important. I have found you have to progressivly set the focus

Forms![Orders].setfocus
Forms![Orders]![order details subform].setfocus
Forms![Orders]![order details subform]![unitprice].setfocus

HTH
Dave
 
This is what I got to work:

Private Sub txtbox_Click()

DoCmd.OpenForm "Popupform"

Me.SetFocus

End Sub

This is the code to open the popup form.

If you need to set focus to a subform change to:

Me!SubformName.Form.SetFocus
 
Thanks Dave and Rob, I used Dave's suggestion first and at first it didn't work. I had it execute on the open event of the pop up form, I moved the code to the on exit of the first field, so when the user clicks the enter key the focus is set to the proper field I needed in the subform. Thanks again....
 

Users who are viewing this thread

Back
Top Bottom