Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2009, 02:29 PM
prabha_friend
Guest
 
Posts: n/a
Default Focus – Some times blurring to me!

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.
 
Old March 23rd, 2009, 08:07 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

The On Exit event does not close the form, it only fires when the form is closing. Is there a save event or some other data processing that is going on at the last text box? You could use the On Lost Focus event of the last text box and put:

Code:
Private Sub SampleText_LostFocus()
   DoCmd.Close , , acSaveYes
End Sub
Can you post the code you are using? Did you use the Tab Order to move focus from one page to the next, or some other?
__________________
mmcdonal

Look it up at: http://wrox.books24x7.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
why does this code run two times? hertendreef Pro VB Databases 1 March 16th, 2007 07:24 AM
Need help exporting data between particular times mlrmlr Access 2 June 25th, 2006 06:12 PM
Server times out chri74 Classic ASP Basics 4 September 17th, 2004 02:35 AM
script times out dazednconfused Beginning PHP 12 August 27th, 2003 07:32 AM
Local times pow1983 Forum and Wrox.com Feedback 4 June 9th, 2003 11:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.