PDA

View Full Version : Focus – Some times blurring to me!



prabhafriend
03-06-2009, 03:53 AM
Hello Friends. I am Prabha Karan from Thanjavur (South India). I am currently working in a Retail Management Tool using Ms-Access. I created a form for invoice which has 1 tab control having three pages in it. I invoke the ‘on-exit’ event for every last object (textbox) in a page to set focus on the first control on the next page. For the first two pages its works fine. I want to close the form after exiting (invoking the ‘on-exit’ event) the last control (text box) on that tab. I used the ‘Docmd’ command object to the close the form, but it says “This action can’t be carried out while processing a form or report event”. Is there a way to do it invoking the ‘on-exit’ event? Primarily my task is to close the form after getting exit from the last control in tab. To the close the form automatically is my task, if it is not possible using the ‘on-exit’ event, kindly, explain why this is not happening in this way? If possible, tell me an alternate. Thanks in Advance.

OBP
03-06-2009, 05:47 AM
One thing that you can do instead of using the On Exit event of the last field on each form to set focus back to the first field is to set the Form's Cycle = Current Record.
The problem with closing the form(s) using the On exit event of the Field may be due to the fact that the Record you were on has not been saved. You could try using a "save" command before trying to close the form.
Or you could try using the a Different Event.
What I don't understand is why you want to close the Form this way, what happens if the User wants to add another Record?
Shouldn't it be up to the User to close the form with a Command Button?