How to specify a single text box on a continous form

A

Adam Thwaites

I have a continous form running off a query.

The first text box is called txtFrom but for some reason when I try to make
code for it refers to the text box by the field it looks at, in this case
'From'. The are 3 records being shown on this continous form and the text box
for each record is called 'From'. I want to make it so when I click on one of
the text boxes it turns red, but at the moment all 3 turn red.

Private Sub From_GotFocus()
From.BackColor = vbRed
End Sub

Is there a way to specify one text box at a time or is this impossible with
continous forms?

all 3 text boxes change colour.
--
Adam Thwaites
Access Database Designer
adam.*spamless*[email protected]
Manchester, UK
(I have no access to other sites apart from microsoft.com so posting
external links is no use to me)
 
P

Phillip Windell

Put the Text box(es) on a single form and insert the continous form into it
as a subform.
Just a guess anyway. I'm only familiar with the principles,..not with the
actual "click here - click there" stuff.

--
Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
-----------------------------------------------------
Understanding the ISA 2004 Access Rule Processing
http://www.isaserver.org/articles/ISA2004_AccessRules.html

Microsoft Internet Security & Acceleration Server: Guidance
http://www.microsoft.com/isaserver/techinfo/Guidance/2004.asp
http://www.microsoft.com/isaserver/techinfo/Guidance/2000.asp

Microsoft Internet Security & Acceleration Server: Partners
http://www.microsoft.com/isaserver/partners/default.asp

Deployment Guidelines for ISA Server 2004 Enterprise Edition
http://www.microsoft.com/technet/prodtechnol/isa/2004/deploy/dgisaserver.mspx
 
A

Adam Thwaites

Unfortunately that's no help, if the text boxes are not on the continous
subform then there won't be one for every record.
--
Adam Thwaites
Access Database Designer
adam.*spamless*[email protected]
Manchester, UK
(I have no access to other sites apart from microsoft.com so posting
external links is no use to me)


Phillip Windell said:
Put the Text box(es) on a single form and insert the continous form into it
as a subform.
Just a guess anyway. I'm only familiar with the principles,..not with the
actual "click here - click there" stuff.

--
Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
-----------------------------------------------------
Understanding the ISA 2004 Access Rule Processing
http://www.isaserver.org/articles/ISA2004_AccessRules.html

Microsoft Internet Security & Acceleration Server: Guidance
http://www.microsoft.com/isaserver/techinfo/Guidance/2004.asp
http://www.microsoft.com/isaserver/techinfo/Guidance/2000.asp

Microsoft Internet Security & Acceleration Server: Partners
http://www.microsoft.com/isaserver/partners/default.asp

Deployment Guidelines for ISA Server 2004 Enterprise Edition
http://www.microsoft.com/technet/prodtechnol/isa/2004/deploy/dgisaserver.mspx
-----------------------------------------------------



Adam Thwaites said:
I have a continous form running off a query.

The first text box is called txtFrom but for some reason when I try to make
code for it refers to the text box by the field it looks at, in this case
'From'. The are 3 records being shown on this continous form and the text box
for each record is called 'From'. I want to make it so when I click on one of
the text boxes it turns red, but at the moment all 3 turn red.

Private Sub From_GotFocus()
From.BackColor = vbRed
End Sub

Is there a way to specify one text box at a time or is this impossible with
continous forms?

all 3 text boxes change colour.
--
Adam Thwaites
Access Database Designer
adam.*spamless*[email protected]
Manchester, UK
(I have no access to other sites apart from microsoft.com so posting
external links is no use to me)
 
P

Phil Hunt

It is not possible to do with code. You can only do that in what they called
Conditional Format from the menu. Hopefully it does what you want.
 
V

Van T. Dinh

1. My work around is to use 2 TextBoxes: TB1 for your current TextBox
("From" is a reserved word in JET so I wouldn't recomment to use From as the
Field name!) and TB2 with red background and both are bound with the same
Field from your RecordSource. Size them so that they exactly the same with
TB1 on top (bring to front) so that TB2 is not visible.

In the TB1 use the GotFocus Event to set the Focus to TB2. Since TB2 has
the Focus, it will be brought to front and visible and TB1 will be pushed to
back and invisible. This will happen only on the current row and the
instances of the TB1 in other rows still remain visible, i.e. no red
background for these instances.

2. See if you can use Stephen Lebans' sample database
"ConditionalFormatting":

http://www.lebans.com/ conditionalformatting.htm
 
A

Adam Thwaites

Works like a charm. Thanks

Why don't you use this Van?
--
Adam Thwaites
Access Database Designer
adam.*spamless*[email protected]
Manchester, UK
(I have no access to other sites apart from microsoft.com so posting
external links is no use to me)
 
V

Van T. Dinh

I actually inferred from my use of 2 ComboBoxes since quite often on a Form
in CtsFormView, I need one unfiltered ComboBox to show correct entries for
all rows except the current row and a filtered (depending on a "previous"
value on the same row) for the user to select an appropriate value out of
the filtered list.

I used Conditional Format before but never thought of using it for the
Focus.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top