Rabu, 10 Mei 2017

Re: [MS_AccessPros] Date Validation

 

Phucon-


This statement makes no sense:

If Not .cboBeginDate & "" = "" And Not .cboEndDate & "" = "" Then

If you're trying toe see if both fields are not empty, then you should do:

    If Len(.cboBeginDate & "") = 0 Or Len(.cboEndDate & "") = 0 Then

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On May 10, 2017, at 4:47 PM, saigonf7q5@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:





Hello 
I am doing a date validation, comparing the Begin Date and the End Date. The RUN button will be enabled only when the Begin Date is less than the End Date.  The code that I have here, sometimes  it's working  right and sometimes it doesn't. I wasn't able to figured out the errors. What is the correct way to do it? 

Phucon


 


 


Private Sub cboBeginDate_BeforeUpdate(Cancel As Integer)

With Me

    If Not .cboBeginDate & "" = "" And Not .cboEndDate & "" = "" Then

        If .cboBeginDate.Value <= .cboEndDate.Value Then

            !cmdRun.Enabled = True

            !cmdClear.Enabled = True

        Else

            !cmdRun.Enabled = False

        End If

    End If

End With

End Sub

 


Private Sub cboEndDate_BeforeUpdate(Cancel As Integer)

With Me

    If Not .cboBeginDate & "" = "" And Not .cboEndDate & "" = "" Then

        If .cboBeginDate.Value <= .cboEndDate.Value Then

            !cmdRun.Enabled = True

            !cmdClear.Enabled = True

        Else

            !cmdRun.Enabled = False

        End If

    End If

End With

End Sub




__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar