[AccessD] ReadyToClose Function - fixed

Dan Waters df.waters at outlook.com
Thu Jul 23 15:30:46 CDT 2015



-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan
Waters
Sent: Thursday, July 23, 2015 3:26 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] ReadyToClose Function

Hi Susan,

I do something like this on forms:
____________________________________
Private Sub butClose_Click()

    If ReadyToClose = False then Exit Sub

End Sub

Private Function ReadyToClose () As Boolean

    If txtNameFirst = "" Then
        txtNameFirst.SetFocus
        ReadyToClose = False
        Exit Sub
    End If

    If txtNameLast = "" Then
        txtNameLast.SetFocus
        ReadyToClose = False
        Exit Sub
    End If

    ReadyToClose = True

End Function
____________________________________

Within the ReadyToClose function you can come up with any conditional
situation you need.  You can also add a message if that helps your users.

Also, for every control on a Form I set the background color to a pale
yellow.  This helps people to quickly see what they need to do.

HTH,
Dan


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list