Enabled Button

S

Steven M. Britton

Why does this case the button to always be disabled?

Private Sub Form_Load()

Me.btnAppendOrders.Enabled = True

If Me.Date = Date Then
Me.btnAppendOrders.Enabled = False
Else
Me.btnAppendOrders.Enabled = True
End If


End Sub
 
R

Rick Brandt

Steven M. Britton said:
Why does this case the button to always be disabled?

Private Sub Form_Load()

Me.btnAppendOrders.Enabled = True

If Me.Date = Date Then
Me.btnAppendOrders.Enabled = False
Else
Me.btnAppendOrders.Enabled = True
End If


End Sub

Because you named a field/control the same as a built in function. Access
can't tell the difference between Me.Date and the function Date so they are
always equal.

Me.[Date] will probably fix it, but you *really* should rename that
field/control.
 
C

Cheryl Fischer

Could be because you are using a Reserved Word (Date) as your Field/Control
name, and using Reserved Words as Field/Control names, Object Names or
Variables may cause unexpected results. (In other words, in Access is
already using the word for something, you can't!)

Try changing it to OrderDate, StartDate or something else that's
descriptive.

Access has quite a list of Reserved Words which can be viewed at:

http://support.microsoft.com/default.aspx?scid=kb;en-us;286335



hth,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top