OnFocus or Activate from another form, both popup modal? (1 Viewer)

Quaeldorn

New member
Local time
Today, 06:06
Joined
Jan 17, 2014
Messages
8
OK, first of all I dont want my users clicking here, there and everywhere so ive set all my forms (except subforms) to modal. They have to deal with each form and close before doing something else. Also I prefer the tidier look that pop-ups give, so all are actually popup modals.

frmOrders = Main Order form details with order number, customer ID and date etc
frmSubOrder = subform within frmOrders, continuous record style, where each individual product, qty and price is added.
frmProdSearch = Opened from a control on frmOrders, users can easily find and select the product they want through comprehensive search functions

What Im after is when the user selects the product they want in frmSearchProd, VBA will close that form, and of course focus automatically returns to frmOrders.

The product code selected in frmSearchProd is set as Public variable so takes what they want from Search to the Order.

I then want an automatic event to fire in frmOrders when focus is returned/activate etc.

(with the eventual view to create a new record in the subform and update txtProductID control with the Public variable as determined in frmProdSearch.. but one thing at a time)

So simply, is there a way for frmOrders to say "yes, I have got control back, thank you!"

I have found out that due to being popup, any code within events for GotFocus and Activate is simply ignored.

Ive already tried to specifically set focus to frmOrders from frmSearchProd with both the click event of the product the customer wants and the Close event of the form itself - no luck :banghead:

Where am I going wrong, or even, do I want the impossible?

Fingers cross folks :D
 

Quaeldorn

New member
Local time
Today, 06:06
Joined
Jan 17, 2014
Messages
8
I dont know if its the proper way, but the only way I figured was upon the user selecting the product they want, call a Public Function that handled both the Variable for the product code and the closing of forms and setting focus to a specific control, rather than try to have events on the forms themselves deal with closing and focus etc.
 

Old Man Devin

Consul Of Code
Local time
Today, 13:06
Joined
Jan 10, 2014
Messages
183
Possible way:
Use the On Timer event on the orders form. It could check one a second to see if the search form is open (or any other forms you might open from it), and if nothing else is open, set the orders form focus. Or was them problem that you can't set focus to the modal pop up forms at all via code?
 

Users who are viewing this thread

Top Bottom