Changing Text on One record on a Continuous sub form 
Author Message
 Changing Text on One record on a Continuous sub form

Can anyone tell me how I could change the forecolor of a text field for only
one record on a continuous subform?

I currently base this decision on a value of a checkbox and need to change
two field red when it evaluates True.  But when I do this, I change this
record plus all other record since this is on a continuous form.

Any help would be great.
Tim Bloomer



Thu, 15 Jun 2000 03:00:00 GMT  
 Changing Text on One record on a Continuous sub form

I don't think it can be done Tim.  I have wanted to do the same thing in
the past.  The color of all records will change according to the current
record.  This isn't obvious in Form view since you are viewing on record at
a time and may be the reason it is confusing.

Mark A. Sam



Fri, 16 Jun 2000 03:00:00 GMT  
 Changing Text on One record on a Continuous sub form

Can't be done. Formatting, hidden values, feeding the brownies, nada. What's
done to one is done to all.
There may be a 3rd party add on some place and there is one forVB 5.

Quote:

>Can anyone tell me how I could change the forecolor of a text field for
only
>one record on a continuous subform?

>I currently base this decision on a value of a checkbox and need to change
>two field red when it evaluates True.  But when I do this, I change this
>record plus all other record since this is on a continuous form.

>Any help would be great.
>Tim Bloomer



Fri, 16 Jun 2000 03:00:00 GMT  
 Changing Text on One record on a Continuous sub form

Thank You,
This was the answer that I was expecting to hear.  I did not think that I
was possible, but wanted to make sure.

Again Thank You to all who took the time to answer my question.
Tim Bloomer

Quote:

>Can't be done. Formatting, hidden values, feeding the brownies, nada.
What's
>done to one is done to all.
>There may be a 3rd party add on some place and there is one forVB 5.



Fri, 16 Jun 2000 03:00:00 GMT  
 Changing Text on One record on a Continuous sub form

Tim,
I've developed a couple of workarounds to this problem that work quite well.
Let me ask a few questions and I'll see if I can give you some code:
Can you describe exactly what you want to do...ie. Is the checkbox on the
subform? Is the checkbos bound to a field in a table/query? Are the fields
you want to change bound to fields in a table/query? Do you want to change
all fields on the subform or just one? Is the field you want to change
edittable or static?

My current understanding of what you have and what you want is this: You
have a continuous subform and for each record of the subform their is a
checkbox, if this box is true, you want a field in the same record on the
subform to be red, if it is false, you want the field to be black (or some
other color)? is this correct?

Also, if you give me the name of your fields, I'll try to give you code you
can plug right in.

Talk to you soon,

James H. Brooks
Brooks Consulting

Quote:

>Can anyone tell me how I could change the forecolor of a text field for
only
>one record on a continuous subform?

>I currently base this decision on a value of a checkbox and need to change
>two field red when it evaluates True.  But when I do this, I change this
>record plus all other record since this is on a continuous form.

>Any help would be great.
>Tim Bloomer



Sat, 17 Jun 2000 03:00:00 GMT  
 Changing Text on One record on a Continuous sub form

Tim,
Here is a solution to your problem. By manipulating several controls and
format properties you can pretty slickly get around Access' limitations.
** Note: This will show you how to do it for field [Order_Num], just copy
the technique for field [Roll_Number]

On your form/subform place the following controls:

ctlHold
ControlSource = [hold] (which should be true/false)

create the next three controls in the following order, it will make things
easier:
for each control, set the background color to transparent

ctlOrderRed
ControlSource: =IIf([ctlHold]=False,[ctlOrderEdit],Null)

Enabled: Yes
Locked: Yes
*** Now do Format -> Send to Back

ctlOrderBlack
ControlSource: =IIf([ctlHold]=True,[ctlOrderedit],Null)

Enabled: No
Locked: Yes
*** Now do Format -> Send to Back

ctlOrderEdit
ControlSource: [Order_Num]
Enabled: Yes
Locked: No
*** Now do Format -> Send to Back

Line up the three controls so that they are right over each other.

Next add the following code to ctlOrderRed_GotFocus()

Dim lngBlack As Long, lngRed As Long

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)

If Me!ctlHold = True Then
    Me!ctlOrderEdit.ForeColor = lngRed
Else
    Me!ctlOrderEdit.ForeColor = lngBlack
End If
Me!ctlOrderEdit.SetFocus

Thats it, your order_num should now be red if hold is true, and black if
hold is false.

How it works....
ctlOrderRed and ctlOrderBlack manipulate the format property, if true,
ctlOrderRed = [Order_Num], else it is null and displays nothing.
ctlOrderBlack is just the opposite. Since the format property can change the
format for each record in a continuous form, we manipulate it to change the
forecolor. By setting the controls to transparent, we overlap their values.
So if ctlHold is true then ctlOrderRed is true, which means it equals the
value in [Order_Num]this overlaps ctlOrderBlack which is null, and
ctlOrderEdit which is black, but hidden behind ctlOrderRed. When you click
on ctlOrderRed, the code for gotfocus executes. This code checks the value
of hold and sets the ctlOrderEdit forecolor to red or black. This actually
changes for all controls on the form, but since this control only shows
while it is being editted (otherwise its in back of the other controls), it
doesn't matter. This procedure can easily be dup,icated for the
[Roll_Number] control as well.

Give it a try and let me know what you think of this workaround.

James H Brooks
Brooks Consulting

Quote:

>Can anyone tell me how I could change the forecolor of a text field for
only
>one record on a continuous subform?

>I currently base this decision on a value of a checkbox and need to change
>two field red when it evaluates True.  But when I do this, I change this
>record plus all other record since this is on a continuous form.

>Any help would be great.
>Tim Bloomer



Sat, 17 Jun 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Changing Text on One record on a Continuous sub form

2. Changing Text on One record on a Continuous sub form

3. Changing Text on One record on a Continuous sub form

4. Changing Text on One record on a Continuous sub form

5. Form/sub-form (continuous) record navigation

6. Forecolor in one field of one record in a continuous form

7. Change one unbound field on a continuous form view subform and they all change

8. checking for dirty records over continuous sub-form

9. Automatically append a record to to continuous sub-form

10. getting rid of default new record at bottom of a sub(continuous)form


 
Powered by phpBB® Forum Software © phpBB Group