Wrox Programmer Forums
|
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 July 27th, 2004, 05:17 PM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default focus not being set correctly

Hi,

Can someone help me with the following focus problem? There are three dates on the form - entry, target, and completed. The on exit event procedure below doesn't reset the focus to the target date field. The focus goes to the next field (completed). If the set focus line is changed to point to the entry date field (ie: Me.EntryDate.SetFocus) then the focus goes to the entry date.

When there's a problem, I'd like the focus to go back to the problem field. Any suggestions ?

Thanks,
Marty

Private Sub TargetDate_Exit(Cancel As Integer)
    If (Me![TargetDate] - Me![EntryDate]) < 0 Then
        MsgBox "The Target Date (" & Me![TargetDate] & ") Can Not Be Earlier Than The Entry Date (" & Me![EntryDate] & ")"
        Me.TargetDate.SetFocus
        Exit Sub
    End If
End Sub
 
Old July 27th, 2004, 08:43 PM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Change the SetFocus to Cancel = True





Similar Threads
Thread Thread Starter Forum Replies Last Post
set focus sameer_1981 Intro Programming 1 February 27th, 2007 09:14 AM
Set Permissions correctly to avoid 80070005 error shogunmike Classic ASP Basics 11 October 25th, 2005 06:50 PM
set focus akibaMaila VB.NET 2002/2003 Basics 1 July 12th, 2005 05:56 PM
how to set focus waley .NET Web Services 1 May 25th, 2004 02:38 PM





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