Controlling Button Property On Form Load (1 Viewer)

DeanFran

Registered User.
Local time
Today, 11:00
Joined
Jan 10, 2014
Messages
111
In the past I've successfully used this technique to control locking of combo boxes, but can't seem to get it to work for enabling or disabling a button.
Scenario: 2 forms frmLogin, and frmMainNavigation The login form has a combo box that includes a column for Access level, with a value of 1 or 2. After a successful login the login form stays open but is invisible, and the navigation form opens. A text box on the nav form is populated with the access level value. Using this value I've tried to compose a macro (On Load for the Nav form) that sets a button enabled property to True or False. Basically this:

Code:
Form : On Load
If txtAccessLevel = 1 Then
SetProperty
      Control Name btnOpenAForm
               Property Enabled
                   Value -1
Else
SetProperty
Control Name btnOpenAForm
               Property Enabled
                   Value 0
End If
I can't get it to work. I keep getting A Return without GoSub Error. What am I doing wrong?
 

mike60smart

Registered User.
Local time
Today, 16:00
Joined
Aug 6, 2017
Messages
1,904
Hi

Why not just use this:-

If txtAccessLevel = 1 Then
Me.btnOpenAForm.enabled = True
Else
Me.btnOpenAForm.enabled = false
End If
 

DeanFran

Registered User.
Local time
Today, 11:00
Joined
Jan 10, 2014
Messages
111
Thank you. I need to stop relying on macros and start forcing myself to use vba.
 

Users who are viewing this thread

Top Bottom