vendredi 8 juillet 2016

Two separated Conditions in One IF (VBA Access 2010)

I have two conditions in a form (VBA Access 2010) that both of them work separately. I put these conditions in "On Load" event of same form and seek time. The first "If" works (related to "Pr330USD" field) but other field (ExpireDate) does not work. "Pr330USD" is a numerical field and "ExpireDate" is a date field.

in below are the codes:

Private Sub Form_Load()

If Me.Pr330USD.Value = "0" Then

    OpenReportFRR.Enabled = False
    OpenFRRDraft.Enabled = True

ElseIf Me.ExpireDate.Text = "" Then

    ValidDateSchedule.Enabled = False
    VDScheduleTable.Enabled = False

Else

    OpenReportFRR.Enabled = True
    OpenFRRDraft.Enabled = False
    ValidDateSchedule.Enabled = True
    VDScheduleTable.Enabled = True

End If

End Sub

....................

Private Sub Pr330USD_BeforeUpdate(Cancel As Integer)

If [Pr330USD].Value = "0" Then

    OpenReportFRR.Enabled = False
    OpenFRRDraft.Enabled = True

Else

    OpenReportFRR.Enabled = True
    OpenFRRDraft.Enabled = False

End If

End Sub

....................

Private Sub ExpireDate_BeforeUpdate(Cancel As Integer)

If Me.ExpireDate.Text = "" Then

    ValidDateSchedule.Enabled = False
    VDScheduleTable.Enabled = False

Else

    ValidDateSchedule.Enabled = True
    VDScheduleTable.Enabled = True

End If

End Sub

....................

I wanna know what happened and what is the solution?

Thanks before I you advise me ....

Kasra

Aucun commentaire:

Enregistrer un commentaire