Event on 'unbound' textbox (1 Viewer)

Safari

Member
Local time
Today, 17:41
Joined
Jun 14, 2021
Messages
95

Hi All

I want to use temporary nemric value in unbound textbox, but i cant seem to run any code on an unbound textbox.
Like :

If nemric value is greater than 1
Make X textbox is enabled

I tried to make it with many events like after update but nothing happened.

Can anyone help me

Thanks in advance
 

June7

AWF VIP
Local time
Today, 07:41
Joined
Mar 9, 2014
Messages
5,466
Works for me. Provide your code. Or provide the database - follow instructions at bottom of my post.
 

Safari

Member
Local time
Today, 17:41
Joined
Jun 14, 2021
Messages
95
Works for me. Provide your code. Or provide the database - follow instructions at bottom of my post.
Code is

If me.unbound textbox.value > 1 then
me.x.enabled=true
End if
 

June7

AWF VIP
Local time
Today, 07:41
Joined
Mar 9, 2014
Messages
5,466
Textbox name is actually "unboundtextbox"?

Conditional Formatting would be better approach than VBA.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 16:41
Joined
Feb 19, 2013
Messages
16,607
have you really called your textbox 'unboundtextbox' and another x?

a shorter version (for your unboundtextbox afterupdate event)
me.x.enabled=me.unboundtextbox>1

or use conditional formatting if x can be conditionally formatted
 

Safari

Member
Local time
Today, 17:41
Joined
Jun 14, 2021
Messages
95
How can I do it with conditional format
have you really called your textbox 'unboundtextbox' and another x?

a shorter version (for your unboundtextbox afterupdate event)
me.x.enabled=me.unboundtextbox>1

or use conditional formatting if x can be conditionally formatted
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:41
Joined
Feb 28, 2001
Messages
27,142
The problem with unbound controls is that a lot of the events relate to updating the underlying record - and that can't happen for unbound controls. You can do things with GotFocus and LostFocus even for unbound controls. You can also use Enter and Exit events for controls. However, some events can be defined but unreachable if they depend on an actual update event (where the underlying record takes on the value from the control.)
 

Safari

Member
Local time
Today, 17:41
Joined
Jun 14, 2021
Messages
95
The problem with unbound controls is that a lot of the events relate to updating the underlying record - and that can't happen for unbound controls. You can do things with GotFocus and LostFocus even for unbound controls. You can also use Enter and Exit events for controls. However, some events can be defined but unreachable if they depend on an actual update event (where the underlying record takes on the value from the control.)
Well done
 

June7

AWF VIP
Local time
Today, 07:41
Joined
Mar 9, 2014
Messages
5,466
AfterUpdate event with unbound control worked for me whether on bound or unbound form.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 16:41
Joined
Feb 19, 2013
Messages
16,607
my assumption is that it is x that needs to disabled and is bound. But the OP is not being very forthcoming about the detail.

to determine if x can be conditionally formatted, see the format ribbon when the form is in edit mode and x has been selected
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:41
Joined
Feb 19, 2002
Messages
43,225
@Safari Please don't start multiple threads on the same topic. If you find a thread has a dead end so you want to change the question, at least provide a link in the new thread. Apparently I just wasted my time answering this question in a different thread.
 

Users who are viewing this thread

Top Bottom