Text Box Activate from other Text Box

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I have a text box called Joining Status in which the letters J, F, or I can
be entered.
There is another text box which is called Initiated which is at present
always enabled.
What I want to do is for the Initiated text box to be enabled only when I is
entered
in the Joining Staus box. ie so when J or F is entered then the Initiated
box is not enabled.
Help appreciated
Jim
 
Jim,

Put the following code in the Before Update event of the Joining Status
textbox:

If Me.[Joining Status] = "I" then
Me.Initiated.Enabled = True
Else
Me.Initiated.Enabled = False
End If

HTH,
Nikos
 
Jim,

Nikos's advice is good from a VBA procedure point of view. In fact, the
code could be simplified to...
Me.Initiated.Enabled = Me.[Joining Status] = "I"

However, since this is a macros newsgroup, here's the macro way...
Condition: [Joining Status]="I"
Action: SetValue
Item: [Initiated].[Enabled]
Expression: Yes

Condition: [Joining Status] In("J","F")
Action: SetValue
Item: [Initiated].[Enabled]
Expression: No

--
Steve Schapel, Microsoft Access MVP


Nikos said:
Jim,

Put the following code in the Before Update event of the Joining Status
textbox:

If Me.[Joining Status] = "I" then
Me.Initiated.Enabled = True
Else
Me.Initiated.Enabled = False
End If

HTH,
Nikos

I have a text box called Joining Status in which the letters J, F, or I
can

be entered.
There is another text box which is called Initiated which is at present
always enabled.
What I want to do is for the Initiated text box to be enabled only when I
is

entered
in the Joining Staus box. ie so when J or F is entered then the Initiated
box is not enabled.
Help appreciated
Jim
 
Hi Steve
As this is my first macro, which goes where?
Thanks
Jim

Steve Schapel said:
Jim,

Nikos's advice is good from a VBA procedure point of view. In fact, the
code could be simplified to...
Me.Initiated.Enabled = Me.[Joining Status] = "I"

However, since this is a macros newsgroup, here's the macro way...
Condition: [Joining Status]="I"
Action: SetValue
Item: [Initiated].[Enabled]
Expression: Yes

Condition: [Joining Status] In("J","F")
Action: SetValue
Item: [Initiated].[Enabled]
Expression: No

--
Steve Schapel, Microsoft Access MVP


Nikos said:
Jim,

Put the following code in the Before Update event of the Joining Status
textbox:

If Me.[Joining Status] = "I" then
Me.Initiated.Enabled = True
Else
Me.Initiated.Enabled = False
End If

HTH,
Nikos

I have a text box called Joining Status in which the letters J, F, or I
can

be entered.
There is another text box which is called Initiated which is at present
always enabled.
What I want to do is for the Initiated text box to be enabled only when
I

is
entered
in the Joining Staus box. ie so when J or F is entered then the Initiated
box is not enabled.
Help appreciated
Jim
 
Jim,

From the Database Window, select the Macros tab, and then click New.
If the macro design window does not display a Condition column, select
Conditions from the View menu. Then you just type in what I said in the
Condition column, enter SetValue in the Action column, and when you
select the SetValue action, you will see the boxes for the entry of the
Item and Expression arguments towards the bottom of the window.
 
Ah Fine, yes it works ok when entering an I (Iniated box clear) F or
J(Initiated box greyed)
as expected.
However If I select a record and click thru the records, the records with a
F or J are not greyed out until F or J is actually entered. I have put the
macro in the Joining
Status box 'Before Update Event' and have now tried all the other events
including every On........ event in the list. No doubt it needs to run from
somewhere,
but which one?
Regards
Jim
 
Jim,

Would it achieve your desired purpose to set the Enabled property of the
Initiated textbox to No in the form design? This would possibly be the
simplest. Otherwise, the On Current event of the form may be applicable
(as well as the AfterUpdate of Joining Status), and change the macro
condition, instead of [Joining Status] In("J","F") try [Joining Status]<>"I"
 
Hi Steve
Using the On Current event and changing the macro works really fine,
and just what was needed!!
Many thanks, don't really know how I could have cracked this one without
your expertise.
Best Wishes
Jim


Steve Schapel said:
Jim,

Would it achieve your desired purpose to set the Enabled property of the
Initiated textbox to No in the form design? This would possibly be the
simplest. Otherwise, the On Current event of the form may be applicable
(as well as the AfterUpdate of Joining Status), and change the macro
condition, instead of [Joining Status] In("J","F") try [Joining
Status] said:
--
Steve Schapel, Microsoft Access MVP

Ah Fine, yes it works ok when entering an I (Iniated box clear) F or
J(Initiated box greyed)
as expected.
However If I select a record and click thru the records, the records with a
F or J are not greyed out until F or J is actually entered. I have put the
macro in the Joining
Status box 'Before Update Event' and have now tried all the other events
including every On........ event in the list. No doubt it needs to run from
somewhere,
but which one?
Regards
Jim
 
Hi Nikos
Many thanks, looks aagood one!
Jim


Nikos Yannacopoulos said:
Jim,

Put the following code in the Before Update event of the Joining Status
textbox:

If Me.[Joining Status] = "I" then
Me.Initiated.Enabled = True
Else
Me.Initiated.Enabled = False
End If

HTH,
Nikos

Jim said:
I have a text box called Joining Status in which the letters J, F, or I can
be entered.
There is another text box which is called Initiated which is at present
always enabled.
What I want to do is for the Initiated text box to be enabled only when
I
is
entered
in the Joining Staus box. ie so when J or F is entered then the Initiated
box is not enabled.
Help appreciated
Jim
 
Back
Top