disable form element if datefield is null

Gr3g0ry

Registered User.
Local time
Yesterday, 16:28
Joined
Oct 12, 2017
Messages
163
Dim draw As Date

If IsNull(draw = Me.cboPartnerId.Column(16)) Then
Me.earlybtn.Enabled = True
Else
Me.earlybtn.Enabled = False
End If

i have null date fields in my database because i opted to not write anything to them in my insert statements.

now i want to check to see if these fields are null, then disable a particular button.

how can i achieve this because my code isnt working.
 
Dim draw As String
draw = Me.cboPartnerId.Column(16) & ""
Me.earlybtn.Enabled = (draw <> "")
 
tried your suggestion of using :

Dim draw As String
draw = Me.cboPartnerId.Column(16) & ""
Me.earlybtn.Enabled = (draw <> "")

still not getting the desired result bro.

if the draw date is null, then set draw button to enabled.
if draw date is not null, then disable the draw button.
 
Code:
If Me.cboPartnerId.Column(16)="" OR isnull(me.cboPartnerID.Column(16)) then
     Me.earlybtn.Enabled = True
Else
     Me.earlybtn.Enabled = False
End If
 
Not what you implied in your first post?
Just change Arnes logic and you have neater/smaller code.

tried your suggestion of using :

Dim draw As String
draw = Me.cboPartnerId.Column(16) & ""
Me.earlybtn.Enabled = (draw <> "")

still not getting the desired result bro.

if the draw date is null, then set draw button to enabled.
if draw date is not null, then disable the draw button.
 

Users who are viewing this thread

Back
Top Bottom