disable form element if datefield is null (1 Viewer)

Gr3g0ry

Registered User.
Local time
Yesterday, 23:17
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:17
Joined
May 7, 2009
Messages
19,245
Dim draw As String
draw = Me.cboPartnerId.Column(16) & ""
Me.earlybtn.Enabled = (draw <> "")
 

Gr3g0ry

Registered User.
Local time
Yesterday, 23:17
Joined
Oct 12, 2017
Messages
163
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.
 

Dystonia

Access 2002, 2010, 2016
Local time
Today, 07:17
Joined
Nov 11, 2017
Messages
17
Code:
If Me.cboPartnerId.Column(16)="" OR isnull(me.cboPartnerID.Column(16)) then
     Me.earlybtn.Enabled = True
Else
     Me.earlybtn.Enabled = False
End If
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:17
Joined
Sep 21, 2011
Messages
14,310
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

Top Bottom