From: nytwodees on
I am using Access 2000.

I have a command button that should be enabled if the OwnerStatus = "Current
Owner" and disabled for any other value.

This is my code:

Function SetOneInvoiceCommand() As Boolean
Dim blnEnable As Boolean

If Me![OwnerStatus] = "Current Owner" Then
OneInvoiceCommand.Enabled = True
Else
OneInvoiceCommand.Enabled = False
End If

End Function

When I 1st enter the form, the OneInvoiceCommand button is ENABLED no matter
what the value is in the OwnerStatus field. However once I click the Owner
Status field once, the code works properly thereafter. Why is the code not
working immediately?

Note: ON Enter (for Owner Status) =SetOneInvoiceCommand()
From: Dorian on
Code only runs when you tell it to run (by calling it) or if it is placed in
an event that gets triggered.
You probably also need to call the code from the Form Load event.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"nytwodees" wrote:

> I am using Access 2000.
>
> I have a command button that should be enabled if the OwnerStatus = "Current
> Owner" and disabled for any other value.
>
> This is my code:
>
> Function SetOneInvoiceCommand() As Boolean
> Dim blnEnable As Boolean
>
> If Me![OwnerStatus] = "Current Owner" Then
> OneInvoiceCommand.Enabled = True
> Else
> OneInvoiceCommand.Enabled = False
> End If
>
> End Function
>
> When I 1st enter the form, the OneInvoiceCommand button is ENABLED no matter
> what the value is in the OwnerStatus field. However once I click the Owner
> Status field once, the code works properly thereafter. Why is the code not
> working immediately?
>
> Note: ON Enter (for Owner Status) =SetOneInvoiceCommand()