From: nytwodees on 14 Dec 2009 13:51 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 14 Dec 2009 14:05 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()
|
Pages: 1 Prev: subform used for changing mainform record Next: Opening up a file on click |