Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Access
3rdpartyusrgrp
access
activexcontrol
adp.sqlserver
commandbarsui
conversion
dataaccess.pages
developers.toolkitode
devtoolkits
externaldata
forms
formscoding
gettingstarted
internet
interopoledde
macros
modulescoding
modulesdaovba
modulesdaovba.ado
multiuser
odbcclientsvr
queries
replication
reports
security
setupconfig
tablesdbdesign
  
 
date: Tue, 8 Jul 2008 12:20:01 -0700,    group: microsoft.public.access.forms        back       


prevent form from closing IF   
How can I prevent a form from closing if the "ProjEnd" date field < 
"ProjStart" date field.  I need to prompt user that they cannot close if the 
"ProjEnd" date < "ProjStart" date.

I do not have a close button.  I use the File, Close in the menu.

Thanks

-- 
deb
date: Tue, 8 Jul 2008 12:20:01 -0700   author:   deb

RE: prevent form from closing IF   
Use the forms Unload event;

Private Sub Form_Unload(Cancel As Integer)

    If Me![ProjEnd] < Me![ProjStart] Then
        MsgBox "The end cannot come before the beginning"
        Cancel = True
        Me![ProjEnd].SetFocus
    End If
    
End Sub
-- 
_________

Sean Bailey


"deb" wrote:

> 
> How can I prevent a form from closing if the "ProjEnd" date field < 
> "ProjStart" date field.  I need to prompt user that they cannot close if the 
> "ProjEnd" date < "ProjStart" date.
> 
> I do not have a close button.  I use the File, Close in the menu.
> 
> Thanks
> 
> -- 
> deb
date: Tue, 8 Jul 2008 12:30:44 -0700   author:   Beetle

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us