PC Review


Reply
Thread Tools Rate Thread

Conditional when has focus

 
 
RJF
Guest
Posts: n/a
 
      12th Aug 2008
I have a form called frm_ClientConv with 3 tab pages on it. (pg_01, pg_02,
pg_03)
There is an unbound control on the form called txt_FilePath.
I don’t want the txt_FilePath control to be visible when pg_03 is selected.

On the Current Event of frm_ClientConv I put the following code:

If [Screen].[ActiveControl].[Name] = "pg_03" Then

txt_FilePath.Visible = False

End If

When I open the form, I get the following error message:

“The expression you entered requires the control to be in the active window.”

I’m fairly new to VB so I realize I could be totally off-base with the code.
Any suggestions would be so appreciated.

Thanks.



--
RJF
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      12th Aug 2008
"RJF" <(E-Mail Removed)> wrote in message
news:40D098A8-E9D6-4BAD-A741-(E-Mail Removed)...
>I have a form called frm_ClientConv with 3 tab pages on it. (pg_01, pg_02,
> pg_03)
> There is an unbound control on the form called txt_FilePath.
> I don’t want the txt_FilePath control to be visible when pg_03 is
> selected.
>
> On the Current Event of frm_ClientConv I put the following code:
>
> If [Screen].[ActiveControl].[Name] = "pg_03" Then
>
> txt_FilePath.Visible = False
>
> End If
>
> When I open the form, I get the following error message:
>
> “The expression you entered requires the control to be in the active
> window.”
>
> I’m fairly new to VB so I realize I could be totally off-base with the
> code.
> Any suggestions would be so appreciated.



You can do this by checking the value of the tab control itself. You didn't
give the name of that control, but suppose it is "tabMyTab". Then your code
might be:

Me.txt_FilePath.Visible = (Me.tabMyTab <> Me.pg_03.PageIndex)


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      12th Aug 2008
(re-sending, as my original reply hasn't appeared)

"RJF" <(E-Mail Removed)> wrote in message
news:40D098A8-E9D6-4BAD-A741-(E-Mail Removed)...
>I have a form called frm_ClientConv with 3 tab pages on it. (pg_01, pg_02,
> pg_03)
> There is an unbound control on the form called txt_FilePath.
> I don’t want the txt_FilePath control to be visible when pg_03 is
> selected.
>
> On the Current Event of frm_ClientConv I put the following code:
>
> If [Screen].[ActiveControl].[Name] = "pg_03" Then
>
> txt_FilePath.Visible = False
>
> End If
>
> When I open the form, I get the following error message:
>
> “The expression you entered requires the control to be in the active
> window.”
>
> I’m fairly new to VB so I realize I could be totally off-base with the
> code.
> Any suggestions would be so appreciated.



You can do this by checking the value of the tab control itself. You didn't
give the name of that control, but suppose it is "tabMyTab". Then your code
might be:

Me.txt_FilePath.Visible = (Me.tabMyTab <> Me.pg_03.PageIndex)


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
RJF
Guest
Posts: n/a
 
      12th Aug 2008
Hi Dirk,

Thank you for your reply and please forgive my ignorance.

Is this the only code I need to put in the On Current Event?

Me.txt_FilePath.Visible = (Me.TabCtl1 <> Me.pg_03.PageIndex)

I put the above statement in On Current of the frm_ClientConv and it works
when I first open the form (and I'm on pg_01) but it doesn't update when I
click on pg_03.

What am I doing wrong?

Thank you,
Rachel

--
RJF


"Dirk Goldgar" wrote:

> (re-sending, as my original reply hasn't appeared)
>
> "RJF" <(E-Mail Removed)> wrote in message
> news:40D098A8-E9D6-4BAD-A741-(E-Mail Removed)...
> >I have a form called frm_ClientConv with 3 tab pages on it. (pg_01, pg_02,
> > pg_03)
> > There is an unbound control on the form called txt_FilePath.
> > I don’t want the txt_FilePath control to be visible when pg_03 is
> > selected.
> >
> > On the Current Event of frm_ClientConv I put the following code:
> >
> > If [Screen].[ActiveControl].[Name] = "pg_03" Then
> >
> > txt_FilePath.Visible = False
> >
> > End If
> >
> > When I open the form, I get the following error message:
> >
> > “The expression you entered requires the control to be in the active
> > window.”
> >
> > I’m fairly new to VB so I realize I could be totally off-base with the
> > code.
> > Any suggestions would be so appreciated.

>
>
> You can do this by checking the value of the tab control itself. You didn't
> give the name of that control, but suppose it is "tabMyTab". Then your code
> might be:
>
> Me.txt_FilePath.Visible = (Me.tabMyTab <> Me.pg_03.PageIndex)
>
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      12th Aug 2008
"RJF" <(E-Mail Removed)> wrote in message
news:5A60898E-8A66-43DB-88D2-(E-Mail Removed)...
> Hi Dirk,
>
> Thank you for your reply and please forgive my ignorance.
>
> Is this the only code I need to put in the On Current Event?
>
> Me.txt_FilePath.Visible = (Me.TabCtl1 <> Me.pg_03.PageIndex)
>
> I put the above statement in On Current of the frm_ClientConv and it works
> when I first open the form (and I'm on pg_01) but it doesn't update when I
> click on pg_03.
>
> What am I doing wrong?
>
> Thank you,
> Rachel



Rachel -

You'll also need to put that line of code into the Change event of the tab
control:

Private Sub TabCtl1_Change()

Me.txt_FilePath.Visible = (Me.TabCtl1 <> Me.pg_03.PageIndex)

End Sub


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
RJF
Guest
Posts: n/a
 
      12th Aug 2008
I just figured that out before I read your last message and was going to
write back that I got it.

Thank you so much for your help and the incredibly quick responses.
--
RJF


"Dirk Goldgar" wrote:

> "RJF" <(E-Mail Removed)> wrote in message
> news:5A60898E-8A66-43DB-88D2-(E-Mail Removed)...
> > Hi Dirk,
> >
> > Thank you for your reply and please forgive my ignorance.
> >
> > Is this the only code I need to put in the On Current Event?
> >
> > Me.txt_FilePath.Visible = (Me.TabCtl1 <> Me.pg_03.PageIndex)
> >
> > I put the above statement in On Current of the frm_ClientConv and it works
> > when I first open the form (and I'm on pg_01) but it doesn't update when I
> > click on pg_03.
> >
> > What am I doing wrong?
> >
> > Thank you,
> > Rachel

>
>
> Rachel -
>
> You'll also need to put that line of code into the Change event of the tab
> control:
>
> Private Sub TabCtl1_Change()
>
> Me.txt_FilePath.Visible = (Me.TabCtl1 <> Me.pg_03.PageIndex)
>
> End Sub
>
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding conditional formating on focus accesskastle Microsoft Access Form Coding 2 4th Nov 2008 01:02 AM
Conditional Formatting with expression to check if field has focus =?Utf-8?B?S3JhenlLb2Rlcg==?= Microsoft Access Forms 5 15th Feb 2007 06:41 PM
conditional formatting (used for "focus" during data entry) =?Utf-8?B?ZGk=?= Microsoft Access Forms 1 15th Jan 2004 06:56 PM
conditional set focus Clan McCreery Microsoft Access Forms 1 11th Aug 2003 08:56 PM
conditional set focus Clan McCreery Microsoft Access Form Coding 1 11th Aug 2003 08:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:57 PM.