Updating a field property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is probably simple, but I'm stuck.

On a form.....
......Fields "A", "B", and "C" all have a green backcolor
......A value is entered into field "A"
......Field "B" is updated via a DLookup
......If field "B" contains a certain string, I would like to set the
Backcolor of field "C" to white (16777215)

I set the backcolor of field "B" to white using Conditional Formatting, but
that won't allow me to use multiple fields (to check the value of a different
field than the one selected).

I've tried the code in different event properties for the form and the
fields - I could use field "A" to check and decide what color field "C"
should be without using field "B". Still no success.

Any pointers are greatly appreciated.
 
You could use conditional formatting for this.
With your form in design view Select Format, Conditional Formatting
In Condition 1 select Expression Is from the dropdown.
In the text box next to Expression Is, Enter the fully qualified name of the
control (not a field, forms don't have fields. Tables and Queries have
fields) and the value you want to check for to change the backcolor to white.

Forms!FormName!ControlName = "A very special string"

Now click on the down arrow to the right of the bucket and select the
backcolor you want for the condition.

Then click OK

OK?
 
Thanks - that sounds like the thing to do. But how does Access handle
wildcards in the expressions. I tried your suggestion, but still don't get
any result. The expression looks like.....

Forms![frmCall Tracking - Issues Log]!txtClientName="OTHER*"

......and still no result.
 
Forms![frmCall Tracking - Issues Log]!txtClientName Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thanks - that sounds like the thing to do. But how does Access handle
wildcards in the expressions. I tried your suggestion, but still don't get
any result. The expression looks like.....

Forms![frmCall Tracking - Issues Log]!txtClientName="OTHER*"

.....and still no result.


Klatuu said:
You could use conditional formatting for this.
With your form in design view Select Format, Conditional Formatting
In Condition 1 select Expression Is from the dropdown.
In the text box next to Expression Is, Enter the fully qualified name of the
control (not a field, forms don't have fields. Tables and Queries have
fields) and the value you want to check for to change the backcolor to white.

Forms!FormName!ControlName = "A very special string"

Now click on the down arrow to the right of the bucket and select the
backcolor you want for the condition.

Then click OK

OK?
 
Thank you very much - it worked. Next question:
The form that contains those text boxes is a subform in a parent form. When
I run the form individually, it works...when I run it through the parent
form, it does not - any ideas?
(The Master and Child fields are linked ocrrectly)


Klatuu said:
Forms![frmCall Tracking - Issues Log]!txtClientName Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thanks - that sounds like the thing to do. But how does Access handle
wildcards in the expressions. I tried your suggestion, but still don't get
any result. The expression looks like.....

Forms![frmCall Tracking - Issues Log]!txtClientName="OTHER*"

.....and still no result.


Klatuu said:
You could use conditional formatting for this.
With your form in design view Select Format, Conditional Formatting
In Condition 1 select Expression Is from the dropdown.
In the text box next to Expression Is, Enter the fully qualified name of the
control (not a field, forms don't have fields. Tables and Queries have
fields) and the value you want to check for to change the backcolor to white.

Forms!FormName!ControlName = "A very special string"

Now click on the down arrow to the right of the bucket and select the
backcolor you want for the condition.

Then click OK

OK?

--
Dave Hargis, Microsoft Access MVP


:

This is probably simple, but I'm stuck.

On a form.....
.....Fields "A", "B", and "C" all have a green backcolor
.....A value is entered into field "A"
.....Field "B" is updated via a DLookup
.....If field "B" contains a certain string, I would like to set the
Backcolor of field "C" to white (16777215)

I set the backcolor of field "B" to white using Conditional Formatting, but
that won't allow me to use multiple fields (to check the value of a different
field than the one selected).

I've tried the code in different event properties for the form and the
fields - I could use field "A" to check and decide what color field "C"
should be without using field "B". Still no success.

Any pointers are greatly appreciated.
 
Yes, When you are in the main form and want to addess properties or objects
in a subform, you have to reference the subform control name and it's form
object. A subform is a control on the form. It's form object is the form
specified in the subform control's Source Object property, so just change the
syntax to:

Forms![frmCall Tracking - Issues Log]!SubFormControlName.Form!txtClientName
Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thank you very much - it worked. Next question:
The form that contains those text boxes is a subform in a parent form. When
I run the form individually, it works...when I run it through the parent
form, it does not - any ideas?
(The Master and Child fields are linked ocrrectly)


Klatuu said:
Forms![frmCall Tracking - Issues Log]!txtClientName Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thanks - that sounds like the thing to do. But how does Access handle
wildcards in the expressions. I tried your suggestion, but still don't get
any result. The expression looks like.....

Forms![frmCall Tracking - Issues Log]!txtClientName="OTHER*"

.....and still no result.


:

You could use conditional formatting for this.
With your form in design view Select Format, Conditional Formatting
In Condition 1 select Expression Is from the dropdown.
In the text box next to Expression Is, Enter the fully qualified name of the
control (not a field, forms don't have fields. Tables and Queries have
fields) and the value you want to check for to change the backcolor to white.

Forms!FormName!ControlName = "A very special string"

Now click on the down arrow to the right of the bucket and select the
backcolor you want for the condition.

Then click OK

OK?

--
Dave Hargis, Microsoft Access MVP


:

This is probably simple, but I'm stuck.

On a form.....
.....Fields "A", "B", and "C" all have a green backcolor
.....A value is entered into field "A"
.....Field "B" is updated via a DLookup
.....If field "B" contains a certain string, I would like to set the
Backcolor of field "C" to white (16777215)

I set the backcolor of field "B" to white using Conditional Formatting, but
that won't allow me to use multiple fields (to check the value of a different
field than the one selected).

I've tried the code in different event properties for the form and the
fields - I could use field "A" to check and decide what color field "C"
should be without using field "B". Still no success.

Any pointers are greatly appreciated.
 
Thanks - you saved me some more time.
So, here's the setup:
1. frmFeedback >> MAIN FORM
2. frmCall Tracking - Issues Log>> SUB FORM

So, the statement should look like (I changed the criteria a bit):

A. Forms![frmCall Tracking - Issues Log]!txtSTIK Like "98*" Or
Forms![frmCall Tracking - Issues Log]!txtSTIK Like "99*" >>original statement
that works when the sub form is run individually (but not as a sub form)

B. Forms!frmFeedback![frmCall Tracking - Issues Log].Form!txtSTIK Like "98*"
Or Forms!frmFeedback![frmCall Tracking - Issues Log].Form!txtSTIK Like "99*"

Looks like the second statement (B) is correct, but the syntax might be off.

Thanks again.

Klatuu said:
Yes, When you are in the main form and want to addess properties or objects
in a subform, you have to reference the subform control name and it's form
object. A subform is a control on the form. It's form object is the form
specified in the subform control's Source Object property, so just change the
syntax to:

Forms![frmCall Tracking - Issues Log]!SubFormControlName.Form!txtClientName
Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thank you very much - it worked. Next question:
The form that contains those text boxes is a subform in a parent form. When
I run the form individually, it works...when I run it through the parent
form, it does not - any ideas?
(The Master and Child fields are linked ocrrectly)


Klatuu said:
Forms![frmCall Tracking - Issues Log]!txtClientName Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


:

Thanks - that sounds like the thing to do. But how does Access handle
wildcards in the expressions. I tried your suggestion, but still don't get
any result. The expression looks like.....

Forms![frmCall Tracking - Issues Log]!txtClientName="OTHER*"

.....and still no result.


:

You could use conditional formatting for this.
With your form in design view Select Format, Conditional Formatting
In Condition 1 select Expression Is from the dropdown.
In the text box next to Expression Is, Enter the fully qualified name of the
control (not a field, forms don't have fields. Tables and Queries have
fields) and the value you want to check for to change the backcolor to white.

Forms!FormName!ControlName = "A very special string"

Now click on the down arrow to the right of the bucket and select the
backcolor you want for the condition.

Then click OK

OK?

--
Dave Hargis, Microsoft Access MVP


:

This is probably simple, but I'm stuck.

On a form.....
.....Fields "A", "B", and "C" all have a green backcolor
.....A value is entered into field "A"
.....Field "B" is updated via a DLookup
.....If field "B" contains a certain string, I would like to set the
Backcolor of field "C" to white (16777215)

I set the backcolor of field "B" to white using Conditional Formatting, but
that won't allow me to use multiple fields (to check the value of a different
field than the one selected).

I've tried the code in different event properties for the form and the
fields - I could use field "A" to check and decide what color field "C"
should be without using field "B". Still no success.

Any pointers are greatly appreciated.
 
B does appear to be correct. Is it not working?

--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thanks - you saved me some more time.
So, here's the setup:
1. frmFeedback >> MAIN FORM
2. frmCall Tracking - Issues Log>> SUB FORM

So, the statement should look like (I changed the criteria a bit):

A. Forms![frmCall Tracking - Issues Log]!txtSTIK Like "98*" Or
Forms![frmCall Tracking - Issues Log]!txtSTIK Like "99*" >>original statement
that works when the sub form is run individually (but not as a sub form)

B. Forms!frmFeedback![frmCall Tracking - Issues Log].Form!txtSTIK Like "98*"
Or Forms!frmFeedback![frmCall Tracking - Issues Log].Form!txtSTIK Like "99*"

Looks like the second statement (B) is correct, but the syntax might be off.

Thanks again.

Klatuu said:
Yes, When you are in the main form and want to addess properties or objects
in a subform, you have to reference the subform control name and it's form
object. A subform is a control on the form. It's form object is the form
specified in the subform control's Source Object property, so just change the
syntax to:

Forms![frmCall Tracking - Issues Log]!SubFormControlName.Form!txtClientName
Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thank you very much - it worked. Next question:
The form that contains those text boxes is a subform in a parent form. When
I run the form individually, it works...when I run it through the parent
form, it does not - any ideas?
(The Master and Child fields are linked ocrrectly)


Klatuu" wrote:

Forms![frmCall Tracking - Issues Log]!txtClientName Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


:

Thanks - that sounds like the thing to do. But how does Access handle
wildcards in the expressions. I tried your suggestion, but still don't get
any result. The expression looks like.....

Forms![frmCall Tracking - Issues Log]!txtClientName="OTHER*"

.....and still no result.


:

You could use conditional formatting for this.
With your form in design view Select Format, Conditional Formatting
In Condition 1 select Expression Is from the dropdown.
In the text box next to Expression Is, Enter the fully qualified name of the
control (not a field, forms don't have fields. Tables and Queries have
fields) and the value you want to check for to change the backcolor to white.

Forms!FormName!ControlName = "A very special string"

Now click on the down arrow to the right of the bucket and select the
backcolor you want for the condition.

Then click OK

OK?

--
Dave Hargis, Microsoft Access MVP


:

This is probably simple, but I'm stuck.

On a form.....
.....Fields "A", "B", and "C" all have a green backcolor
.....A value is entered into field "A"
.....Field "B" is updated via a DLookup
.....If field "B" contains a certain string, I would like to set the
Backcolor of field "C" to white (16777215)

I set the backcolor of field "B" to white using Conditional Formatting, but
that won't allow me to use multiple fields (to check the value of a different
field than the one selected).

I've tried the code in different event properties for the form and the
fields - I could use field "A" to check and decide what color field "C"
should be without using field "B". Still no success.

Any pointers are greatly appreciated.
 
Dave,
Thanks for all the help. Since I'm not a proficient Access/VBA
'programmer', my syntax sucks, but I try. I tried to put the conditional
formatting into an event procedure and IT WORKED (I was even impressed...just
a little). I used the following:

In the subform ([frmCall Tracking - Issues Log]) >> txtSTIK (control) >> On
Exit (event) >> If txtSTIK Like "98*" Or txtSTIK Like "99*" Then
txtOtherClientName.Visible = True (I originally hid the control and made it
visible if the criteria was met). This avoided the 'nested Forms' statement
and the conditional criteria (that wasn't working).

I like the phrase, "As long as it works..." (it's a companion of "If it
ain't broke...")

Thanks again.


Klatuu said:
Yes, When you are in the main form and want to addess properties or objects
in a subform, you have to reference the subform control name and it's form
object. A subform is a control on the form. It's form object is the form
specified in the subform control's Source Object property, so just change the
syntax to:

Forms![frmCall Tracking - Issues Log]!SubFormControlName.Form!txtClientName
Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thank you very much - it worked. Next question:
The form that contains those text boxes is a subform in a parent form. When
I run the form individually, it works...when I run it through the parent
form, it does not - any ideas?
(The Master and Child fields are linked ocrrectly)


Klatuu said:
Forms![frmCall Tracking - Issues Log]!txtClientName Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


:

Thanks - that sounds like the thing to do. But how does Access handle
wildcards in the expressions. I tried your suggestion, but still don't get
any result. The expression looks like.....

Forms![frmCall Tracking - Issues Log]!txtClientName="OTHER*"

.....and still no result.


:

You could use conditional formatting for this.
With your form in design view Select Format, Conditional Formatting
In Condition 1 select Expression Is from the dropdown.
In the text box next to Expression Is, Enter the fully qualified name of the
control (not a field, forms don't have fields. Tables and Queries have
fields) and the value you want to check for to change the backcolor to white.

Forms!FormName!ControlName = "A very special string"

Now click on the down arrow to the right of the bucket and select the
backcolor you want for the condition.

Then click OK

OK?

--
Dave Hargis, Microsoft Access MVP


:

This is probably simple, but I'm stuck.

On a form.....
.....Fields "A", "B", and "C" all have a green backcolor
.....A value is entered into field "A"
.....Field "B" is updated via a DLookup
.....If field "B" contains a certain string, I would like to set the
Backcolor of field "C" to white (16777215)

I set the backcolor of field "B" to white using Conditional Formatting, but
that won't allow me to use multiple fields (to check the value of a different
field than the one selected).

I've tried the code in different event properties for the form and the
fields - I could use field "A" to check and decide what color field "C"
should be without using field "B". Still no success.

Any pointers are greatly appreciated.
 
Very good. The only thing I would do differently would be to put it in the
After Update event.
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Dave,
Thanks for all the help. Since I'm not a proficient Access/VBA
'programmer', my syntax sucks, but I try. I tried to put the conditional
formatting into an event procedure and IT WORKED (I was even impressed...just
a little). I used the following:

In the subform ([frmCall Tracking - Issues Log]) >> txtSTIK (control) >> On
Exit (event) >> If txtSTIK Like "98*" Or txtSTIK Like "99*" Then
txtOtherClientName.Visible = True (I originally hid the control and made it
visible if the criteria was met). This avoided the 'nested Forms' statement
and the conditional criteria (that wasn't working).

I like the phrase, "As long as it works..." (it's a companion of "If it
ain't broke...")

Thanks again.


Klatuu said:
Yes, When you are in the main form and want to addess properties or objects
in a subform, you have to reference the subform control name and it's form
object. A subform is a control on the form. It's form object is the form
specified in the subform control's Source Object property, so just change the
syntax to:

Forms![frmCall Tracking - Issues Log]!SubFormControlName.Form!txtClientName
Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


ReportSmith said:
Thank you very much - it worked. Next question:
The form that contains those text boxes is a subform in a parent form. When
I run the form individually, it works...when I run it through the parent
form, it does not - any ideas?
(The Master and Child fields are linked ocrrectly)


Klatuu" wrote:

Forms![frmCall Tracking - Issues Log]!txtClientName Like "OTHER*"
--
Dave Hargis, Microsoft Access MVP


:

Thanks - that sounds like the thing to do. But how does Access handle
wildcards in the expressions. I tried your suggestion, but still don't get
any result. The expression looks like.....

Forms![frmCall Tracking - Issues Log]!txtClientName="OTHER*"

.....and still no result.


:

You could use conditional formatting for this.
With your form in design view Select Format, Conditional Formatting
In Condition 1 select Expression Is from the dropdown.
In the text box next to Expression Is, Enter the fully qualified name of the
control (not a field, forms don't have fields. Tables and Queries have
fields) and the value you want to check for to change the backcolor to white.

Forms!FormName!ControlName = "A very special string"

Now click on the down arrow to the right of the bucket and select the
backcolor you want for the condition.

Then click OK

OK?

--
Dave Hargis, Microsoft Access MVP


:

This is probably simple, but I'm stuck.

On a form.....
.....Fields "A", "B", and "C" all have a green backcolor
.....A value is entered into field "A"
.....Field "B" is updated via a DLookup
.....If field "B" contains a certain string, I would like to set the
Backcolor of field "C" to white (16777215)

I set the backcolor of field "B" to white using Conditional Formatting, but
that won't allow me to use multiple fields (to check the value of a different
field than the one selected).

I've tried the code in different event properties for the form and the
fields - I could use field "A" to check and decide what color field "C"
should be without using field "B". Still no success.

Any pointers are greatly appreciated.
 
Back
Top