|
 |
access thread: more formatting
Message #1 by "Steve Klein" <Stephen@K...> on Mon, 25 Nov 2002 12:39:04 -0000
|
|
Signed StationeryI have a QBF form with 30 controls on it . If clients run
the filter and is not happy with the result they may wish to return to the
QBF form. In order to draw attention to the fact that the form already
holds data I wish to highlight any populated controls.
I have done this by an on activate event which says
If Not IsNull(Me.txtClient_ID) Then
Me.txtClient_ID.BackColor = 33023
Else
Me.txtClient_ID.BackColor = 16777215
End If
Do I have to repatet this 29 more times or is there any way of saying
if not isnull (anyofmycontrols) ... ...
Steve K
~~~~~~~~~~~~~~~~~~
Steve Klein
tel: 0118 984 5109
mobile 0797 181 5676
~~~~~~~~~~~~~~~~~
Message #2 by "Carnley, Dave" <dcarnley@a...> on Mon, 25 Nov 2002 10:38:18 -0600
|
|
This is a synthesis of two things I have seen done, maybe this will give you
an idea:
each form has a collection called CONTROLS that holds an object for every
control on the form. Every control has a property named "Tag" which exists
for the programmer to put info there for use by the program. So, you can,
in the form designer, edit your form and in the tag property for any control
that you want to change color on when populated, put a standard value in the
tag, something like "ChangeOnPopulated". Then, in your activate event, you
can use FOR..EACH to loop through the CONTROLS collection, and if any
control has a tag containing "ChangeOnPopulated", set the backcolor to your
desired value.
Or another way to do it might be, use the color number you want it to become
as the tag value, and if tag value is not null on a control then set the
color to the number contained in tag...
-----Original Message-----
From: Steve Klein [mailto:Stephen@K...]
Sent: Monday, November 25, 2002 6:39 AM
To: Access
Subject: [access] more formatting
Signed StationeryI have a QBF form with 30 controls on it . If clients run
the filter and is not happy with the result they may wish to return to the
QBF form. In order to draw attention to the fact that the form already
holds data I wish to highlight any populated controls.
I have done this by an on activate event which says
If Not IsNull(Me.txtClient_ID) Then
Me.txtClient_ID.BackColor = 33023
Else
Me.txtClient_ID.BackColor = 16777215
End If
Do I have to repatet this 29 more times or is there any way of saying
if not isnull (anyofmycontrols) ... ...
Steve K
~~~~~~~~~~~~~~~~~~
Steve Klein
tel: 0118 984 5109
mobile 0797 181 5676
~~~~~~~~~~~~~~~~~
Message #3 by "Bob Bedell" <bobbedell15@m...> on Mon, 25 Nov 2002 17:50:13 +0000
|
|
Hi Steve,
This doesn't really do what you want, but you might be able to run with
it. Each textbox and combobox has a FormatConditions collection. You
can add a FormatCondition object to each control using the object's Add
method. You just do that once and save the settings with the form. Then
your code can instruct the control to behave in a specified way each
time the condition is satisfied. Following Dave's suggesion of
iterating through the controls collection, you might do something like
this:
For Each ctl In frm.Controls
If (ctl.ControlType = acTextBox) Or _
(ctl.ControlType = acComboBox) Then
'Add a FormatCondition
ctl.FormatConditions.Add acFieldHasFocus
'And set its properties
With ctl.FormatConditions(0)
.FontBold = True
.BackColor = 10092543
End With
End If
Next ctl
Each time a combbox or textbox recieves the focus, it gets a yellow
background and a bold font. It's background and font return to normal
when focus moves to the next control. That sort of thing.
There is an acFieldValue condition constant, but I couldn't figure out
how to get it to handle a Not IsNull condition. It only seems to want
to work with arithmetic operators which require values.
Worth taking a look at anyway.
Bob
>From: "Steve Klein" <Stephen@K...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] more formatting
>Date: Mon, 25 Nov 2002 12:39:04 -0000
>
>Signed StationeryI have a QBF form with 30 controls on it . If clients run
>the filter and is not happy with the result they may wish to return to the
>QBF form. In order to draw attention to the fact that the form already
>holds data I wish to highlight any populated controls.
>
>I have done this by an on activate event which says
>
>
>If Not IsNull(Me.txtClient_ID) Then
> Me.txtClient_ID.BackColor = 33023
> Else
> Me.txtClient_ID.BackColor = 16777215
>End If
>
>Do I have to repatet this 29 more times or is there any way of saying
>
>if not isnull (anyofmycontrols) ... ...
>
>
>Steve K
>~~~~~~~~~~~~~~~~~~
>Steve Klein
>tel: 0118 984 5109
>mobile 0797 181 5676
>~~~~~~~~~~~~~~~~~
>
>
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
Message #4 by "Steve Klein" <Stephen@K...> on Wed, 27 Nov 2002 10:54:33 -0000
|
|
I think I am missing things here.
1. I can get it to do some of the job but get a error message run_time
'error 438 object does not support this type or method'
2. I also do not know how to specify
if not isnull ctl then ... ... ...
3. Finally one control, which I added later, seems to think it is not part
of the collection and does not not accept the formatting instruction. It
may be because it is the last control in the collection. I don't know
*************************
Private Sub Form_Activate()
Dim ctl As Control
For Each ctl In Me.Controls
ctl.BackColor = 33023
Next ctl
End Sub
*************************
recommendations about using tags are complicated by the fact that they are
already in use for the QBF stuff
Steve K
-----Original Message-----
From: Bob Bedell [mailto:bobbedell15@m...]
Sent: 25 November 2002 17:50
To: Access
Subject: [access] Re: more formatting
Hi Steve,
This doesn't really do what you want, but you might be able to run with
it. Each textbox and combobox has a FormatConditions collection. You
can add a FormatCondition object to each control using the object's Add
method. You just do that once and save the settings with the form. Then
your code can instruct the control to behave in a specified way each
time the condition is satisfied. Following Dave's suggesion of
iterating through the controls collection, you might do something like
this:
For Each ctl In frm.Controls
If (ctl.ControlType = acTextBox) Or _
(ctl.ControlType = acComboBox) Then
'Add a FormatCondition
ctl.FormatConditions.Add acFieldHasFocus
'And set its properties
With ctl.FormatConditions(0)
.FontBold = True
.BackColor = 10092543
End With
End If
Next ctl
Each time a combbox or textbox recieves the focus, it gets a yellow
background and a bold font. It's background and font return to normal
when focus moves to the next control. That sort of thing.
There is an acFieldValue condition constant, but I couldn't figure out
how to get it to handle a Not IsNull condition. It only seems to want
to work with arithmetic operators which require values.
Worth taking a look at anyway.
Bob
>From: "Steve Klein" <Stephen@K...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] more formatting
>Date: Mon, 25 Nov 2002 12:39:04 -0000
>
>Signed StationeryI have a QBF form with 30 controls on it . If clients run
>the filter and is not happy with the result they may wish to return to the
>QBF form. In order to draw attention to the fact that the form already
>holds data I wish to highlight any populated controls.
>
>I have done this by an on activate event which says
>
>
>If Not IsNull(Me.txtClient_ID) Then
> Me.txtClient_ID.BackColor = 33023
> Else
> Me.txtClient_ID.BackColor = 16777215
>End If
>
>Do I have to repatet this 29 more times or is there any way of saying
>
>if not isnull (anyofmycontrols) ... ...
>
>
>Steve K
>~~~~~~~~~~~~~~~~~~
>Steve Klein
>tel: 0118 984 5109
>mobile 0797 181 5676
>~~~~~~~~~~~~~~~~~
>
>
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
Message #5 by "Gregory Serrano" <SerranoG@m...> on Wed, 27 Nov 2002 13:35:40
|
|
Steve,
<< If Not IsNull(Me.txtClient_ID) Then
Me.txtClient_ID.BackColor = 33023
Else
Me.txtClient_ID.BackColor = 16777215
End If
Do I have to repatet this 29 more times or is there any way of saying
if not isnull (anyofmycontrols) ... ... >>
Use the Controls collection and then have something like
For Each Control
If IsNull(Control) Then
'Don't highlight
Else
'Highlight
End IF
Next
I'm not sure of the exact syntax because I've never done it before, but
this should work. I'm sure if I rush it I'll give you buggy code! Would
anyone out there care to fill in the blanks? Thanks.
Greg
Message #6 by "Bob Bedell" <bobbedell15@m...> on Wed, 27 Nov 2002 14:51:35 +0000
|
|
Hi Steve,
Look at the Backcolor property in help to see which controls support
a backcolor property. Reference only those controls using the
ControlType property like so:
Sub Form_Activate()
Dim ctl As Control
Const conBackColor = 33023
For Each ctl In Me.Controls
With ctl
Select Case .ControlType
Case acLabel, acTextBox, acComboBox
.BackColor = conBackColor
End Select
End With
Next ctl
End Sub
I'm not sure about specifying Null.
Best
Bob
>From: "Steve Klein" <Stephen@K...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] Re: more formatting
>Date: Wed, 27 Nov 2002 10:54:33 -0000
>
>I think I am missing things here.
>
>
>1. I can get it to do some of the job but get a error message run_time
>'error 438 object does not support this type or method'
>2. I also do not know how to specify
>
> if not isnull ctl then ... ... ...
>
>3. Finally one control, which I added later, seems to think it is not part
>of the collection and does not not accept the formatting instruction. It
>may be because it is the last control in the collection. I don't know
>
>
>*************************
>
>Private Sub Form_Activate()
>
>Dim ctl As Control
>
> For Each ctl In Me.Controls
> ctl.BackColor = 33023
> Next ctl
>
>End Sub
>
>*************************
>
>recommendations about using tags are complicated by the fact that they are
>already in use for the QBF stuff
>
>
>Steve K
>
>
>-----Original Message-----
>From: Bob Bedell [mailto:bobbedell15@m...]
>Sent: 25 November 2002 17:50
>To: Access
>Subject: [access] Re: more formatting
>
>
>Hi Steve,
>
>This doesn't really do what you want, but you might be able to run with
>it. Each textbox and combobox has a FormatConditions collection. You
>can add a FormatCondition object to each control using the object's Add
>method. You just do that once and save the settings with the form. Then
>your code can instruct the control to behave in a specified way each
>time the condition is satisfied. Following Dave's suggesion of
>iterating through the controls collection, you might do something like
>this:
>
>For Each ctl In frm.Controls
> If (ctl.ControlType = acTextBox) Or _
> (ctl.ControlType = acComboBox) Then
> 'Add a FormatCondition
> ctl.FormatConditions.Add acFieldHasFocus
> 'And set its properties
> With ctl.FormatConditions(0)
> .FontBold = True
> .BackColor = 10092543
> End With
> End If
>Next ctl
>
>Each time a combbox or textbox recieves the focus, it gets a yellow
>background and a bold font. It's background and font return to normal
>when focus moves to the next control. That sort of thing.
>
>There is an acFieldValue condition constant, but I couldn't figure out
>how to get it to handle a Not IsNull condition. It only seems to want
>to work with arithmetic operators which require values.
>
>Worth taking a look at anyway.
>
>Bob
>
> >From: "Steve Klein" <Stephen@K...>
> >Reply-To: "Access" <access@p...>
> >To: "Access" <access@p...>
> >Subject: [access] more formatting
> >Date: Mon, 25 Nov 2002 12:39:04 -0000
> >
> >Signed StationeryI have a QBF form with 30 controls on it . If clients
>run
> >the filter and is not happy with the result they may wish to return to
>the
> >QBF form. In order to draw attention to the fact that the form already
> >holds data I wish to highlight any populated controls.
> >
> >I have done this by an on activate event which says
> >
> >
> >If Not IsNull(Me.txtClient_ID) Then
> > Me.txtClient_ID.BackColor = 33023
> > Else
> > Me.txtClient_ID.BackColor = 16777215
> >End If
> >
> >Do I have to repatet this 29 more times or is there any way of saying
> >
> >if not isnull (anyofmycontrols) ... ...
> >
> >
> >Steve K
> >~~~~~~~~~~~~~~~~~~
> >Steve Klein
> >tel: 0118 984 5109
> >mobile 0797 181 5676
> >~~~~~~~~~~~~~~~~~
> >
> >
>
>
>_________________________________________________________________
>The new MSN 8: smart spam protection and 2 months FREE*
>http://join.msn.com/?page=features/junkmail
>
>
>
>
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
Message #7 by "Carnley, Dave" <dcarnley@a...> on Wed, 27 Nov 2002 09:09:30 -0600
|
|
"recommendations about using tags are complicated by the fact that they are
already in use for the QBF stuff"
I was wondering about that when I wrote my recommendation about tags... we
actually do use multiple tag values for different things, too, but I was
simplifying. What we do is store it in a sortof meta-data format, like
"FormatConditional=TRUE;SupervisorRO=FALSE;Mode=R". We have a module with
some proceduresin it for parsing and extracting values, so I can say
if TagValue(ctl.tag,"FormatConditional") = "TRUE" then...
if you want to see that code just say the word... it's pretty basic string
handling
-----Original Message-----
From: Steve Klein [mailto:Stephen@K...]
Sent: Wednesday, November 27, 2002 4:55 AM
To: Access
Subject: [access] Re: more formatting
I think I am missing things here.
1. I can get it to do some of the job but get a error message run_time
'error 438 object does not support this type or method'
2. I also do not know how to specify
if not isnull ctl then ... ... ...
3. Finally one control, which I added later, seems to think it is not
part
of the collection and does not not accept the formatting instruction. It
may be because it is the last control in the collection. I don't know
*************************
Private Sub Form_Activate()
Dim ctl As Control
For Each ctl In Me.Controls
ctl.BackColor = 33023
Next ctl
End Sub
*************************
recommendations about using tags are complicated by the fact that they are
already in use for the QBF stuff
Steve K
-----Original Message-----
From: Bob Bedell [mailto:bobbedell15@m...]
Sent: 25 November 2002 17:50
To: Access
Subject: [access] Re: more formatting
Hi Steve,
This doesn't really do what you want, but you might be able to run with
it. Each textbox and combobox has a FormatConditions collection. You
can add a FormatCondition object to each control using the object's Add
method. You just do that once and save the settings with the form. Then
your code can instruct the control to behave in a specified way each
time the condition is satisfied. Following Dave's suggesion of
iterating through the controls collection, you might do something like
this:
For Each ctl In frm.Controls
If (ctl.ControlType = acTextBox) Or _
(ctl.ControlType = acComboBox) Then
'Add a FormatCondition
ctl.FormatConditions.Add acFieldHasFocus
'And set its properties
With ctl.FormatConditions(0)
.FontBold = True
.BackColor = 10092543
End With
End If
Next ctl
Each time a combbox or textbox recieves the focus, it gets a yellow
background and a bold font. It's background and font return to normal
when focus moves to the next control. That sort of thing.
There is an acFieldValue condition constant, but I couldn't figure out
how to get it to handle a Not IsNull condition. It only seems to want
to work with arithmetic operators which require values.
Worth taking a look at anyway.
Bob
>From: "Steve Klein" <Stephen@K...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] more formatting
>Date: Mon, 25 Nov 2002 12:39:04 -0000
>
>Signed StationeryI have a QBF form with 30 controls on it . If clients run
>the filter and is not happy with the result they may wish to return to the
>QBF form. In order to draw attention to the fact that the form already
>holds data I wish to highlight any populated controls.
>
>I have done this by an on activate event which says
>
>
>If Not IsNull(Me.txtClient_ID) Then
> Me.txtClient_ID.BackColor = 33023
> Else
> Me.txtClient_ID.BackColor = 16777215
>End If
>
>Do I have to repatet this 29 more times or is there any way of saying
>
>if not isnull (anyofmycontrols) ... ...
>
>
>Steve K
>~~~~~~~~~~~~~~~~~~
>Steve Klein
>tel: 0118 984 5109
>mobile 0797 181 5676
>~~~~~~~~~~~~~~~~~
>
>
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
Message #8 by "Steve Klein" <Stephen@K...> on Wed, 27 Nov 2002 15:06:58 -0000
|
|
Hi Bob,
That bit works - terrific. Interesting, I only had text boxes on the form
but it still wanted the control type specification.
now for the 'is null', 'is empty' etc.
Steve K
-----Original Message-----
From: Bob Bedell [mailto:bobbedell15@m...]
Sent: 27 November 2002 14:52
To: Access
Subject: [access] Re: more formatting
Hi Steve,
Look at the Backcolor property in help to see which controls support
a backcolor property. Reference only those controls using the
ControlType property like so:
Sub Form_Activate()
Dim ctl As Control
Const conBackColor = 33023
For Each ctl In Me.Controls
With ctl
Select Case .ControlType
Case acLabel, acTextBox, acComboBox
.BackColor = conBackColor
End Select
End With
Next ctl
End Sub
I'm not sure about specifying Null.
Best
Bob
>From: "Steve Klein" <Stephen@K...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] Re: more formatting
>Date: Wed, 27 Nov 2002 10:54:33 -0000
>
>I think I am missing things here.
>
>
>1. I can get it to do some of the job but get a error message run_time
>'error 438 object does not support this type or method'
>2. I also do not know how to specify
>
> if not isnull ctl then ... ... ...
>
>3. Finally one control, which I added later, seems to think it is not part
>of the collection and does not not accept the formatting instruction. It
>may be because it is the last control in the collection. I don't know
>
>
>*************************
>
>Private Sub Form_Activate()
>
>Dim ctl As Control
>
> For Each ctl In Me.Controls
> ctl.BackColor = 33023
> Next ctl
>
>End Sub
>
>*************************
>
>recommendations about using tags are complicated by the fact that they are
>already in use for the QBF stuff
>
>
>Steve K
>
>
>-----Original Message-----
>From: Bob Bedell [mailto:bobbedell15@m...]
>Sent: 25 November 2002 17:50
>To: Access
>Subject: [access] Re: more formatting
>
>
>Hi Steve,
>
>This doesn't really do what you want, but you might be able to run with
>it. Each textbox and combobox has a FormatConditions collection. You
>can add a FormatCondition object to each control using the object's Add
>method. You just do that once and save the settings with the form. Then
>your code can instruct the control to behave in a specified way each
>time the condition is satisfied. Following Dave's suggesion of
>iterating through the controls collection, you might do something like
>this:
>
>For Each ctl In frm.Controls
> If (ctl.ControlType = acTextBox) Or _
> (ctl.ControlType = acComboBox) Then
> 'Add a FormatCondition
> ctl.FormatConditions.Add acFieldHasFocus
> 'And set its properties
> With ctl.FormatConditions(0)
> .FontBold = True
> .BackColor = 10092543
> End With
> End If
>Next ctl
>
>Each time a combbox or textbox recieves the focus, it gets a yellow
>background and a bold font. It's background and font return to normal
>when focus moves to the next control. That sort of thing.
>
>There is an acFieldValue condition constant, but I couldn't figure out
>how to get it to handle a Not IsNull condition. It only seems to want
>to work with arithmetic operators which require values.
>
>Worth taking a look at anyway.
>
>Bob
>
> >From: "Steve Klein" <Stephen@K...>
> >Reply-To: "Access" <access@p...>
> >To: "Access" <access@p...>
> >Subject: [access] more formatting
> >Date: Mon, 25 Nov 2002 12:39:04 -0000
> >
> >Signed StationeryI have a QBF form with 30 controls on it . If clients
>run
> >the filter and is not happy with the result they may wish to return to
>the
> >QBF form. In order to draw attention to the fact that the form already
> >holds data I wish to highlight any populated controls.
> >
> >I have done this by an on activate event which says
> >
> >
> >If Not IsNull(Me.txtClient_ID) Then
> > Me.txtClient_ID.BackColor = 33023
> > Else
> > Me.txtClient_ID.BackColor = 16777215
> >End If
> >
> >Do I have to repatet this 29 more times or is there any way of saying
> >
> >if not isnull (anyofmycontrols) ... ...
> >
> >
> >Steve K
> >~~~~~~~~~~~~~~~~~~
> >Steve Klein
> >tel: 0118 984 5109
> >mobile 0797 181 5676
> >~~~~~~~~~~~~~~~~~
> >
> >
>
>
>_________________________________________________________________
>The new MSN 8: smart spam protection and 2 months FREE*
>http://join.msn.com/?page=features/junkmail
>
>
>
>
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
Message #9 by "Bob Bedell" <bobbedell15@m...> on Wed, 27 Nov 2002 18:50:19 +0000
|
|
Hi Steve,
How 'bout?
Sub Form_Activate()
Dim ctl As Control
Const conBackColor = 33023
For Each ctl In Me.Controls
With ctl
If .ControlType = acTextBox Then
If Not IsNull(ctl) Then
.BackColor = conBackColor
End If
End If
End With
Next ctl
End Sub
>From: "Steve Klein" <Stephen@K...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] Re: more formatting
>Date: Wed, 27 Nov 2002 15:06:58 -0000
>
>Hi Bob,
>
>That bit works - terrific. Interesting, I only had text boxes on the form
>but it still wanted the control type specification.
>
>
>now for the 'is null', 'is empty' etc.
>
>
>
>Steve K
>
>
>-----Original Message-----
>From: Bob Bedell [mailto:bobbedell15@m...]
>Sent: 27 November 2002 14:52
>To: Access
>Subject: [access] Re: more formatting
>
>
>Hi Steve,
>
>Look at the Backcolor property in help to see which controls support
>a backcolor property. Reference only those controls using the
>ControlType property like so:
>
>Sub Form_Activate()
> Dim ctl As Control
> Const conBackColor = 33023
> For Each ctl In Me.Controls
> With ctl
> Select Case .ControlType
> Case acLabel, acTextBox, acComboBox
> .BackColor = conBackColor
> End Select
> End With
> Next ctl
>End Sub
>
>I'm not sure about specifying Null.
>
>Best
>
>Bob
>
>
> >From: "Steve Klein" <Stephen@K...>
> >Reply-To: "Access" <access@p...>
> >To: "Access" <access@p...>
> >Subject: [access] Re: more formatting
> >Date: Wed, 27 Nov 2002 10:54:33 -0000
> >
> >I think I am missing things here.
> >
> >
> >1. I can get it to do some of the job but get a error message run_time
> >'error 438 object does not support this type or method'
> >2. I also do not know how to specify
> >
> > if not isnull ctl then ... ... ...
> >
> >3. Finally one control, which I added later, seems to think it is not
>part
> >of the collection and does not not accept the formatting instruction. It
> >may be because it is the last control in the collection. I don't know
> >
> >
> >*************************
> >
> >Private Sub Form_Activate()
> >
> >Dim ctl As Control
> >
> > For Each ctl In Me.Controls
> > ctl.BackColor = 33023
> > Next ctl
> >
> >End Sub
> >
> >*************************
> >
> >recommendations about using tags are complicated by the fact that they
>are
> >already in use for the QBF stuff
> >
> >
> >Steve K
> >
> >
> >-----Original Message-----
> >From: Bob Bedell [mailto:bobbedell15@m...]
> >Sent: 25 November 2002 17:50
> >To: Access
> >Subject: [access] Re: more formatting
> >
> >
> >Hi Steve,
> >
> >This doesn't really do what you want, but you might be able to run with
> >it. Each textbox and combobox has a FormatConditions collection. You
> >can add a FormatCondition object to each control using the object's Add
> >method. You just do that once and save the settings with the form. Then
> >your code can instruct the control to behave in a specified way each
> >time the condition is satisfied. Following Dave's suggesion of
> >iterating through the controls collection, you might do something like
> >this:
> >
> >For Each ctl In frm.Controls
> > If (ctl.ControlType = acTextBox) Or _
> > (ctl.ControlType = acComboBox) Then
> > 'Add a FormatCondition
> > ctl.FormatConditions.Add acFieldHasFocus
> > 'And set its properties
> > With ctl.FormatConditions(0)
> > .FontBold = True
> > .BackColor = 10092543
> > End With
> > End If
> >Next ctl
> >
> >Each time a combbox or textbox recieves the focus, it gets a yellow
> >background and a bold font. It's background and font return to normal
> >when focus moves to the next control. That sort of thing.
> >
> >There is an acFieldValue condition constant, but I couldn't figure out
> >how to get it to handle a Not IsNull condition. It only seems to want
> >to work with arithmetic operators which require values.
> >
> >Worth taking a look at anyway.
> >
> >Bob
> >
> > >From: "Steve Klein" <Stephen@K...>
> > >Reply-To: "Access" <access@p...>
> > >To: "Access" <access@p...>
> > >Subject: [access] more formatting
> > >Date: Mon, 25 Nov 2002 12:39:04 -0000
> > >
> > >Signed StationeryI have a QBF form with 30 controls on it . If clients
> >run
> > >the filter and is not happy with the result they may wish to return to
> >the
> > >QBF form. In order to draw attention to the fact that the form already
> > >holds data I wish to highlight any populated controls.
> > >
> > >I have done this by an on activate event which says
> > >
> > >
> > >If Not IsNull(Me.txtClient_ID) Then
> > > Me.txtClient_ID.BackColor = 33023
> > > Else
> > > Me.txtClient_ID.BackColor = 16777215
> > >End If
> > >
> > >Do I have to repatet this 29 more times or is there any way of saying
> > >
> > >if not isnull (anyofmycontrols) ... ...
> > >
> > >
> > >Steve K
> > >~~~~~~~~~~~~~~~~~~
> > >Steve Klein
> > >tel: 0118 984 5109
> > >mobile 0797 181 5676
> > >~~~~~~~~~~~~~~~~~
> > >
> > >
> >
> >
> >_________________________________________________________________
> >The new MSN 8: smart spam protection and 2 months FREE*
> >http://join.msn.com/?page=features/junkmail
> >
> >
> >
> >
>
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*.
>http://join.msn.com/?page=features/featuredemail
>
>
>
>
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
Message #10 by "Steve Klein" <Stephen@K...> on Wed, 27 Nov 2002 21:25:38 -0000
|
|
You are a genius - thank you so much
Steve K
-----Original Message-----
From: Bob Bedell [mailto:bobbedell15@m...]
Sent: 27 November 2002 18:50
To: Access
Subject: [access] Re: more formatting
Hi Steve,
How 'bout?
Sub Form_Activate()
Dim ctl As Control
Const conBackColor = 33023
For Each ctl In Me.Controls
With ctl
If .ControlType = acTextBox Then
If Not IsNull(ctl) Then
.BackColor = conBackColor
End If
End If
End With
Next ctl
End Sub
>From: "Steve Klein" <Stephen@K...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] Re: more formatting
>Date: Wed, 27 Nov 2002 15:06:58 -0000
>
>Hi Bob,
>
>That bit works - terrific. Interesting, I only had text boxes on the form
>but it still wanted the control type specification.
>
>
>now for the 'is null', 'is empty' etc.
>
>
>
>Steve K
>
>
>-----Original Message-----
>From: Bob Bedell [mailto:bobbedell15@m...]
>Sent: 27 November 2002 14:52
>To: Access
>Subject: [access] Re: more formatting
>
>
>Hi Steve,
>
>Look at the Backcolor property in help to see which controls support
>a backcolor property. Reference only those controls using the
>ControlType property like so:
>
>Sub Form_Activate()
> Dim ctl As Control
> Const conBackColor = 33023
> For Each ctl In Me.Controls
> With ctl
> Select Case .ControlType
> Case acLabel, acTextBox, acComboBox
> .BackColor = conBackColor
> End Select
> End With
> Next ctl
>End Sub
>
>I'm not sure about specifying Null.
>
>Best
>
>Bob
>
>
> >From: "Steve Klein" <Stephen@K...>
> >Reply-To: "Access" <access@p...>
> >To: "Access" <access@p...>
> >Subject: [access] Re: more formatting
> >Date: Wed, 27 Nov 2002 10:54:33 -0000
> >
> >I think I am missing things here.
> >
> >
> >1. I can get it to do some of the job but get a error message run_time
> >'error 438 object does not support this type or method'
> >2. I also do not know how to specify
> >
> > if not isnull ctl then ... ... ...
> >
> >3. Finally one control, which I added later, seems to think it is not
>part
> >of the collection and does not not accept the formatting instruction. It
> >may be because it is the last control in the collection. I don't know
> >
> >
> >*************************
> >
> >Private Sub Form_Activate()
> >
> >Dim ctl As Control
> >
> > For Each ctl In Me.Controls
> > ctl.BackColor = 33023
> > Next ctl
> >
> >End Sub
> >
> >*************************
> >
> >recommendations about using tags are complicated by the fact that they
>are
> >already in use for the QBF stuff
> >
> >
> >Steve K
> >
> >
> >-----Original Message-----
> >From: Bob Bedell [mailto:bobbedell15@m...]
> >Sent: 25 November 2002 17:50
> >To: Access
> >Subject: [access] Re: more formatting
> >
> >
> >Hi Steve,
> >
> >This doesn't really do what you want, but you might be able to run with
> >it. Each textbox and combobox has a FormatConditions collection. You
> >can add a FormatCondition object to each control using the object's Add
> >method. You just do that once and save the settings with the form. Then
> >your code can instruct the control to behave in a specified way each
> >time the condition is satisfied. Following Dave's suggesion of
> >iterating through the controls collection, you might do something like
> >this:
> >
> >For Each ctl In frm.Controls
> > If (ctl.ControlType = acTextBox) Or _
> > (ctl.ControlType = acComboBox) Then
> > 'Add a FormatCondition
> > ctl.FormatConditions.Add acFieldHasFocus
> > 'And set its properties
> > With ctl.FormatConditions(0)
> > .FontBold = True
> > .BackColor = 10092543
> > End With
> > End If
> >Next ctl
> >
> >Each time a combbox or textbox recieves the focus, it gets a yellow
> >background and a bold font. It's background and font return to normal
> >when focus moves to the next control. That sort of thing.
> >
> >There is an acFieldValue condition constant, but I couldn't figure out
> >how to get it to handle a Not IsNull condition. It only seems to want
> >to work with arithmetic operators which require values.
> >
> >Worth taking a look at anyway.
> >
> >Bob
> >
> > >From: "Steve Klein" <Stephen@K...>
> > >Reply-To: "Access" <access@p...>
> > >To: "Access" <access@p...>
> > >Subject: [access] more formatting
> > >Date: Mon, 25 Nov 2002 12:39:04 -0000
> > >
> > >Signed StationeryI have a QBF form with 30 controls on it . If clients
> >run
> > >the filter and is not happy with the result they may wish to return to
> >the
> > >QBF form. In order to draw attention to the fact that the form already
> > >holds data I wish to highlight any populated controls.
> > >
> > >I have done this by an on activate event which says
> > >
> > >
> > >If Not IsNull(Me.txtClient_ID) Then
> > > Me.txtClient_ID.BackColor = 33023
> > > Else
> > > Me.txtClient_ID.BackColor = 16777215
> > >End If
> > >
> > >Do I have to repatet this 29 more times or is there any way of saying
> > >
> > >if not isnull (anyofmycontrols) ... ...
> > >
> > >
> > >Steve K
> > >~~~~~~~~~~~~~~~~~~
> > >Steve Klein
> > >tel: 0118 984 5109
> > >mobile 0797 181 5676
> > >~~~~~~~~~~~~~~~~~
> > >
> > >
> >
> >
> >_________________________________________________________________
> >The new MSN 8: smart spam protection and 2 months FREE*
> >http://join.msn.com/?page=features/junkmail
> >
> >
> >
> >
>
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*.
>http://join.msn.com/?page=features/featuredemail
>
>
>
>
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
|
|
 |