A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Highlight current record



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2008, 04:18 PM posted to microsoft.public.access.forms
RobGMiller
external usenet poster
 
Posts: 58
Default Highlight current record

Access 2003.

Need to highlight the current record on a subform setup in continuous forms
view.

I found a way to do it a long time ago by setting the value of a control on
the main or parent form to the value of a LineNumber control on the current
record of the subform which is always a unique value. This is done in the
OnCurrent event of the subform. As you move through the records the OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I change the
background color if Expression Is: Me!LineNumber = ParentForm!LineNumber or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or move to
it using the cursor(arrow) keys the background would change color. Now the
background color will only change color if a record is updated due to a
change in value of one of its controls.

I've made many changes to this application since this technique last worked.
None of which seems related to this type of thing. I though someone might
have some insight as to how the Conditional Formatting works. i.e. What
triggers the formatting of all the controls on a record when the record or
one of its controls gets the focus.

I am sure that no background code runs as different records get the focus
unless something is changed. I've tried repaint instead of refresh which was
used after the value of the ParentForm control is set from the OnCurrent
Event of the subform. Requery looses the focus alltogether so its useless in
this case.




RobGMiller
  #2  
Old June 4th, 2008, 11:12 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Highlight current record

Rob,
it sounds as if your most recent changes to this form or its query/table
have intereferred with the technique working.
Go back to one of your backups where this form did work for conditional
formatting and see if you can find what is different in the latest version
of your database.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Access 2003.

Need to highlight the current record on a subform setup in continuous
forms
view.

I found a way to do it a long time ago by setting the value of a control
on
the main or parent form to the value of a LineNumber control on the
current
record of the subform which is always a unique value. This is done in the
OnCurrent event of the subform. As you move through the records the
OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I change
the
background color if Expression Is: Me!LineNumber = ParentForm!LineNumber
or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or move
to
it using the cursor(arrow) keys the background would change color. Now the
background color will only change color if a record is updated due to a
change in value of one of its controls.

I've made many changes to this application since this technique last
worked.
None of which seems related to this type of thing. I though someone might
have some insight as to how the Conditional Formatting works. i.e. What
triggers the formatting of all the controls on a record when the record or
one of its controls gets the focus.

I am sure that no background code runs as different records get the focus
unless something is changed. I've tried repaint instead of refresh which
was
used after the value of the ParentForm control is set from the OnCurrent
Event of the subform. Requery looses the focus alltogether so its useless
in
this case.




RobGMiller



  #3  
Old June 5th, 2008, 05:34 AM posted to microsoft.public.access.forms
RobGMiller
external usenet poster
 
Posts: 58
Default Highlight current record

Thanks for that Jeanette,

There have been so many changes since the last working version that its
worth the trouble of attemting to understand the process so that I can avoid
trying to iliminate what might have happened that caused this failure.

I suppose that one could argue that whatever functionality has been added
that caused the breakdown is necessary and the time required to find a way of
doing it that does not interfere with this process might very well take
longer than understanding the process. One might also argue that it is likely
necessary to understand the highlight process well enough to make the new
functionality work withought disrupting the record highlight process.

--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
it sounds as if your most recent changes to this form or its query/table
have intereferred with the technique working.
Go back to one of your backups where this form did work for conditional
formatting and see if you can find what is different in the latest version
of your database.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Access 2003.

Need to highlight the current record on a subform setup in continuous
forms
view.

I found a way to do it a long time ago by setting the value of a control
on
the main or parent form to the value of a LineNumber control on the
current
record of the subform which is always a unique value. This is done in the
OnCurrent event of the subform. As you move through the records the
OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I change
the
background color if Expression Is: Me!LineNumber = ParentForm!LineNumber
or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or move
to
it using the cursor(arrow) keys the background would change color. Now the
background color will only change color if a record is updated due to a
change in value of one of its controls.

I've made many changes to this application since this technique last
worked.
None of which seems related to this type of thing. I though someone might
have some insight as to how the Conditional Formatting works. i.e. What
triggers the formatting of all the controls on a record when the record or
one of its controls gets the focus.

I am sure that no background code runs as different records get the focus
unless something is changed. I've tried repaint instead of refresh which
was
used after the value of the ParentForm control is set from the OnCurrent
Event of the subform. Requery looses the focus alltogether so its useless
in
this case.




RobGMiller




  #4  
Old June 5th, 2008, 12:17 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Highlight current record

Rob,
I noticed that you used the expression
Me!LineNumber = ParentForm!LineNumber

Instead of ParentForm!LineNumber
use
Parent!LineNumber

As an aid to debug it, try code like this on the form's On Current event

Debug.Print "Parent!LineNumber: " & Parent!LineNumber
Debug.Print "Me!LineNumber: " & Me!LineNumber

Run the form, then go Ctl + G to open the immediate window and see what
values access found for the line number.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Access 2003.

Need to highlight the current record on a subform setup in continuous
forms
view.

I found a way to do it a long time ago by setting the value of a control
on
the main or parent form to the value of a LineNumber control on the
current
record of the subform which is always a unique value. This is done in the
OnCurrent event of the subform. As you move through the records the
OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I change
the
background color if Expression Is: Me!LineNumber = ParentForm!LineNumber
or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or move
to
it using the cursor(arrow) keys the background would change color. Now the
background color will only change color if a record is updated due to a
change in value of one of its controls.

I've made many changes to this application since this technique last
worked.
None of which seems related to this type of thing. I though someone might
have some insight as to how the Conditional Formatting works. i.e. What
triggers the formatting of all the controls on a record when the record or
one of its controls gets the focus.

I am sure that no background code runs as different records get the focus
unless something is changed. I've tried repaint instead of refresh which
was
used after the value of the ParentForm control is set from the OnCurrent
Event of the subform. Requery looses the focus alltogether so its useless
in
this case.




RobGMiller



  #5  
Old June 5th, 2008, 02:03 PM posted to microsoft.public.access.forms
RobGMiller
external usenet poster
 
Posts: 58
Default Highlight current record

If I view the value of Forms!ParentForm!LineNumber immediatly after setting
it in the OnCurrent event as you suggest it shows the correct value for the
current record.

If the conditional formatting of the controls on the current record occurs
after the OnCurrent event is done then the correct value should be returned.

What might prevent the conditionnal formatting process to run in a normal
sequence?

What is the normal sequence of events that occur as a control on a record
gets the focus in a subform in continuous forms view?
--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
I noticed that you used the expression
Me!LineNumber = ParentForm!LineNumber

Instead of ParentForm!LineNumber
use
Parent!LineNumber

As an aid to debug it, try code like this on the form's On Current event

Debug.Print "Parent!LineNumber: " & Parent!LineNumber
Debug.Print "Me!LineNumber: " & Me!LineNumber

Run the form, then go Ctl + G to open the immediate window and see what
values access found for the line number.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Access 2003.

Need to highlight the current record on a subform setup in continuous
forms
view.

I found a way to do it a long time ago by setting the value of a control
on
the main or parent form to the value of a LineNumber control on the
current
record of the subform which is always a unique value. This is done in the
OnCurrent event of the subform. As you move through the records the
OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I change
the
background color if Expression Is: Me!LineNumber = ParentForm!LineNumber
or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or move
to
it using the cursor(arrow) keys the background would change color. Now the
background color will only change color if a record is updated due to a
change in value of one of its controls.

I've made many changes to this application since this technique last
worked.
None of which seems related to this type of thing. I though someone might
have some insight as to how the Conditional Formatting works. i.e. What
triggers the formatting of all the controls on a record when the record or
one of its controls gets the focus.

I am sure that no background code runs as different records get the focus
unless something is changed. I've tried repaint instead of refresh which
was
used after the value of the ParentForm control is set from the OnCurrent
Event of the subform. Requery looses the focus alltogether so its useless
in
this case.




RobGMiller




  #6  
Old June 6th, 2008, 01:14 AM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Highlight current record

Rob,
in the normal sequence of events, there is only one *real* copy of each
control on a continuous form.
I'm not really sure how conditional formatting deals with this.
Some questions:
1. As you are using Forms!ParentForm!LineNumber, does this mean that the
subform is on a different form from Forms!ParentForm!LineNumber ?
Normally with a parent and child - form/subform setup you refer to the
control on the parent form as Parent.ControlName when the code is running in
the subform.
If not, are you sure that Forms!ParentForm!LineNumber is open at the same
time as the subform.

2. How do you get the value for Forms!ParentForm!LineNumber - does it come
from a field in this form's recordsource?

3. Which field in the subform's recordsource is related one to many to the
parent form's recordsource?

I am more familiar with setting conditional formatting using the value of a
control - if the field value is 0, then make the text box have a red
background, if not, then make it have a white background.
You are using -If Expression - maybe someone else with experience with
exactly this can jump in with the answer.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
If I view the value of Forms!ParentForm!LineNumber immediatly after
setting
it in the OnCurrent event as you suggest it shows the correct value for
the
current record.

If the conditional formatting of the controls on the current record occurs
after the OnCurrent event is done then the correct value should be
returned.

What might prevent the conditionnal formatting process to run in a normal
sequence?

What is the normal sequence of events that occur as a control on a record
gets the focus in a subform in continuous forms view?
--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
I noticed that you used the expression
Me!LineNumber = ParentForm!LineNumber

Instead of ParentForm!LineNumber
use
Parent!LineNumber

As an aid to debug it, try code like this on the form's On Current event

Debug.Print "Parent!LineNumber: " & Parent!LineNumber
Debug.Print "Me!LineNumber: " & Me!LineNumber

Run the form, then go Ctl + G to open the immediate window and see what
values access found for the line number.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Access 2003.

Need to highlight the current record on a subform setup in continuous
forms
view.

I found a way to do it a long time ago by setting the value of a
control
on
the main or parent form to the value of a LineNumber control on the
current
record of the subform which is always a unique value. This is done in
the
OnCurrent event of the subform. As you move through the records the
OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I
change
the
background color if Expression Is: Me!LineNumber =
ParentForm!LineNumber
or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or
move
to
it using the cursor(arrow) keys the background would change color. Now
the
background color will only change color if a record is updated due to a
change in value of one of its controls.

I've made many changes to this application since this technique last
worked.
None of which seems related to this type of thing. I though someone
might
have some insight as to how the Conditional Formatting works. i.e. What
triggers the formatting of all the controls on a record when the record
or
one of its controls gets the focus.

I am sure that no background code runs as different records get the
focus
unless something is changed. I've tried repaint instead of refresh
which
was
used after the value of the ParentForm control is set from the
OnCurrent
Event of the subform. Requery looses the focus alltogether so its
useless
in
this case.




RobGMiller







  #7  
Old June 6th, 2008, 06:59 AM posted to microsoft.public.access.forms
RobGMiller
external usenet poster
 
Posts: 58
Default Highlight current record

Thanks for your time Jeanette,

I think the subform is opened prior to the parent form but the
SubForm.OnCurrent even must fire after the parent form is opened as the first
record gets the focus.

The technique is comparing the value of a control(LineNumber) on the current
record to the value of a different control located elsewhere (LN) containing
a number. If the value is the same, it formats the background to a different
color.

The value of LN has to be changed before the controls on the current record
are updated using the conditional format process. The OnCurrent event must
fire prior to the conditional format process since this was working before.

The subform is in a SubForm container on a different form as in:
Forms!ParentForm!SubformContainer.Form
LN is updated from the subform OnCurrent even as the focus moves to the next
record as in:
Forms!ParentForm!LN = Me!LineNumber
As I mentioned before, Forms!ParentForm!LN does get changed as soon as the
Forms!ParentForm!LN = Me!LineNumber action is taken in the OnCurrent event.

I remember the first thing I tried when I came up with this technique was to
set the LN.ControlSource to
=Forms!ParentForm!SubformContainer.Form!LineNumber but that did not work.
However setting the value of LN with the OnCurrent event did until recently.

--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
in the normal sequence of events, there is only one *real* copy of each
control on a continuous form.
I'm not really sure how conditional formatting deals with this.
Some questions:
1. As you are using Forms!ParentForm!LineNumber, does this mean that the
subform is on a different form from Forms!ParentForm!LineNumber ?
Normally with a parent and child - form/subform setup you refer to the
control on the parent form as Parent.ControlName when the code is running in
the subform.
If not, are you sure that Forms!ParentForm!LineNumber is open at the same
time as the subform.

2. How do you get the value for Forms!ParentForm!LineNumber - does it come
from a field in this form's recordsource?

3. Which field in the subform's recordsource is related one to many to the
parent form's recordsource?

I am more familiar with setting conditional formatting using the value of a
control - if the field value is 0, then make the text box have a red
background, if not, then make it have a white background.
You are using -If Expression - maybe someone else with experience with
exactly this can jump in with the answer.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
If I view the value of Forms!ParentForm!LineNumber immediatly after
setting
it in the OnCurrent event as you suggest it shows the correct value for
the
current record.

If the conditional formatting of the controls on the current record occurs
after the OnCurrent event is done then the correct value should be
returned.

What might prevent the conditionnal formatting process to run in a normal
sequence?

What is the normal sequence of events that occur as a control on a record
gets the focus in a subform in continuous forms view?
--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
I noticed that you used the expression
Me!LineNumber = ParentForm!LineNumber

Instead of ParentForm!LineNumber
use
Parent!LineNumber

As an aid to debug it, try code like this on the form's On Current event

Debug.Print "Parent!LineNumber: " & Parent!LineNumber
Debug.Print "Me!LineNumber: " & Me!LineNumber

Run the form, then go Ctl + G to open the immediate window and see what
values access found for the line number.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Access 2003.

Need to highlight the current record on a subform setup in continuous
forms
view.

I found a way to do it a long time ago by setting the value of a
control
on
the main or parent form to the value of a LineNumber control on the
current
record of the subform which is always a unique value. This is done in
the
OnCurrent event of the subform. As you move through the records the
OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I
change
the
background color if Expression Is: Me!LineNumber =
ParentForm!LineNumber
or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or
move
to
it using the cursor(arrow) keys the background would change color. Now
the
background color will only change color if a record is updated due to a
change in value of one of its controls.

I've made many changes to this application since this technique last
worked.
None of which seems related to this type of thing. I though someone
might
have some insight as to how the Conditional Formatting works. i.e. What
triggers the formatting of all the controls on a record when the record
or
one of its controls gets the focus.

I am sure that no background code runs as different records get the
focus
unless something is changed. I've tried repaint instead of refresh
which
was
used after the value of the ParentForm control is set from the
OnCurrent
Event of the subform. Requery looses the focus alltogether so its
useless
in
this case.




RobGMiller







  #8  
Old June 6th, 2008, 07:17 AM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Highlight current record

Here is a link to a previous post which highlights the current record.
I think it will be more helpful than continuing with your current coding
approach.

http://groups.google.com/group/micro...1e19777c9c2fc7

Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Thanks for your time Jeanette,

I think the subform is opened prior to the parent form but the
SubForm.OnCurrent even must fire after the parent form is opened as the
first
record gets the focus.

The technique is comparing the value of a control(LineNumber) on the
current
record to the value of a different control located elsewhere (LN)
containing
a number. If the value is the same, it formats the background to a
different
color.

The value of LN has to be changed before the controls on the current
record
are updated using the conditional format process. The OnCurrent event must
fire prior to the conditional format process since this was working
before.

The subform is in a SubForm container on a different form as in:
Forms!ParentForm!SubformContainer.Form
LN is updated from the subform OnCurrent even as the focus moves to the
next
record as in:
Forms!ParentForm!LN = Me!LineNumber
As I mentioned before, Forms!ParentForm!LN does get changed as soon as the
Forms!ParentForm!LN = Me!LineNumber action is taken in the OnCurrent
event.

I remember the first thing I tried when I came up with this technique was
to
set the LN.ControlSource to
=Forms!ParentForm!SubformContainer.Form!LineNumber but that did not work.
However setting the value of LN with the OnCurrent event did until
recently.

--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
in the normal sequence of events, there is only one *real* copy of each
control on a continuous form.
I'm not really sure how conditional formatting deals with this.
Some questions:
1. As you are using Forms!ParentForm!LineNumber, does this mean that the
subform is on a different form from Forms!ParentForm!LineNumber ?
Normally with a parent and child - form/subform setup you refer to the
control on the parent form as Parent.ControlName when the code is running
in
the subform.
If not, are you sure that Forms!ParentForm!LineNumber is open at the same
time as the subform.

2. How do you get the value for Forms!ParentForm!LineNumber - does it
come
from a field in this form's recordsource?

3. Which field in the subform's recordsource is related one to many to
the
parent form's recordsource?

I am more familiar with setting conditional formatting using the value of
a
control - if the field value is 0, then make the text box have a red
background, if not, then make it have a white background.
You are using -If Expression - maybe someone else with experience with
exactly this can jump in with the answer.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
If I view the value of Forms!ParentForm!LineNumber immediatly after
setting
it in the OnCurrent event as you suggest it shows the correct value for
the
current record.

If the conditional formatting of the controls on the current record
occurs
after the OnCurrent event is done then the correct value should be
returned.

What might prevent the conditionnal formatting process to run in a
normal
sequence?

What is the normal sequence of events that occur as a control on a
record
gets the focus in a subform in continuous forms view?
--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
I noticed that you used the expression
Me!LineNumber = ParentForm!LineNumber

Instead of ParentForm!LineNumber
use
Parent!LineNumber

As an aid to debug it, try code like this on the form's On Current
event

Debug.Print "Parent!LineNumber: " & Parent!LineNumber
Debug.Print "Me!LineNumber: " & Me!LineNumber

Run the form, then go Ctl + G to open the immediate window and see
what
values access found for the line number.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Access 2003.

Need to highlight the current record on a subform setup in
continuous
forms
view.

I found a way to do it a long time ago by setting the value of a
control
on
the main or parent form to the value of a LineNumber control on the
current
record of the subform which is always a unique value. This is done
in
the
OnCurrent event of the subform. As you move through the records the
OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I
change
the
background color if Expression Is: Me!LineNumber =
ParentForm!LineNumber
or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or
move
to
it using the cursor(arrow) keys the background would change color.
Now
the
background color will only change color if a record is updated due
to a
change in value of one of its controls.

I've made many changes to this application since this technique last
worked.
None of which seems related to this type of thing. I though someone
might
have some insight as to how the Conditional Formatting works. i.e.
What
triggers the formatting of all the controls on a record when the
record
or
one of its controls gets the focus.

I am sure that no background code runs as different records get the
focus
unless something is changed. I've tried repaint instead of refresh
which
was
used after the value of the ParentForm control is set from the
OnCurrent
Event of the subform. Requery looses the focus alltogether so its
useless
in
this case.




RobGMiller









  #9  
Old June 6th, 2008, 01:48 PM posted to microsoft.public.access.forms
RobGMiller
external usenet poster
 
Posts: 58
Default Highlight current record

Thanks for that Jeanette,

The only difference between what that page suggests and what I am doing is
that OnCurrent sets the value of a control that is located on the Subform as
opposed to its parent.

However, it does work.

I am guessing that the Subform change is more immediate than its parent. Not
sure why I didn't put it there in the first place. I suppose, when something
works you leave it until it breaks....

Thanks again for your time.

--
RobGMiller


"Jeanette Cunningham" wrote:

Here is a link to a previous post which highlights the current record.
I think it will be more helpful than continuing with your current coding
approach.

http://groups.google.com/group/micro...1e19777c9c2fc7

Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Thanks for your time Jeanette,

I think the subform is opened prior to the parent form but the
SubForm.OnCurrent even must fire after the parent form is opened as the
first
record gets the focus.

The technique is comparing the value of a control(LineNumber) on the
current
record to the value of a different control located elsewhere (LN)
containing
a number. If the value is the same, it formats the background to a
different
color.

The value of LN has to be changed before the controls on the current
record
are updated using the conditional format process. The OnCurrent event must
fire prior to the conditional format process since this was working
before.

The subform is in a SubForm container on a different form as in:
Forms!ParentForm!SubformContainer.Form
LN is updated from the subform OnCurrent even as the focus moves to the
next
record as in:
Forms!ParentForm!LN = Me!LineNumber
As I mentioned before, Forms!ParentForm!LN does get changed as soon as the
Forms!ParentForm!LN = Me!LineNumber action is taken in the OnCurrent
event.

I remember the first thing I tried when I came up with this technique was
to
set the LN.ControlSource to
=Forms!ParentForm!SubformContainer.Form!LineNumber but that did not work.
However setting the value of LN with the OnCurrent event did until
recently.

--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
in the normal sequence of events, there is only one *real* copy of each
control on a continuous form.
I'm not really sure how conditional formatting deals with this.
Some questions:
1. As you are using Forms!ParentForm!LineNumber, does this mean that the
subform is on a different form from Forms!ParentForm!LineNumber ?
Normally with a parent and child - form/subform setup you refer to the
control on the parent form as Parent.ControlName when the code is running
in
the subform.
If not, are you sure that Forms!ParentForm!LineNumber is open at the same
time as the subform.

2. How do you get the value for Forms!ParentForm!LineNumber - does it
come
from a field in this form's recordsource?

3. Which field in the subform's recordsource is related one to many to
the
parent form's recordsource?

I am more familiar with setting conditional formatting using the value of
a
control - if the field value is 0, then make the text box have a red
background, if not, then make it have a white background.
You are using -If Expression - maybe someone else with experience with
exactly this can jump in with the answer.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
If I view the value of Forms!ParentForm!LineNumber immediatly after
setting
it in the OnCurrent event as you suggest it shows the correct value for
the
current record.

If the conditional formatting of the controls on the current record
occurs
after the OnCurrent event is done then the correct value should be
returned.

What might prevent the conditionnal formatting process to run in a
normal
sequence?

What is the normal sequence of events that occur as a control on a
record
gets the focus in a subform in continuous forms view?
--
RobGMiller


"Jeanette Cunningham" wrote:

Rob,
I noticed that you used the expression
Me!LineNumber = ParentForm!LineNumber

Instead of ParentForm!LineNumber
use
Parent!LineNumber

As an aid to debug it, try code like this on the form's On Current
event

Debug.Print "Parent!LineNumber: " & Parent!LineNumber
Debug.Print "Me!LineNumber: " & Me!LineNumber

Run the form, then go Ctl + G to open the immediate window and see
what
values access found for the line number.


Jeanette Cunningham -- Melbourne Victoria Australia


"RobGMiller" wrote in message
...
Access 2003.

Need to highlight the current record on a subform setup in
continuous
forms
view.

I found a way to do it a long time ago by setting the value of a
control
on
the main or parent form to the value of a LineNumber control on the
current
record of the subform which is always a unique value. This is done
in
the
OnCurrent event of the subform. As you move through the records the
OnCurrent
event fires and updates the Parentform control.

In Conditional formatting for a field that never gets the focus I
change
the
background color if Expression Is: Me!LineNumber =
ParentForm!LineNumber
or
somethign to that effect.

This worked perfectly until recently. If you clicked on a record or
move
to
it using the cursor(arrow) keys the background would change color.
Now
the
background color will only change color if a record is updated due
to a
change in value of one of its controls.

I've made many changes to this application since this technique last
worked.
None of which seems related to this type of thing. I though someone
might
have some insight as to how the Conditional Formatting works. i.e.
What
triggers the formatting of all the controls on a record when the
record
or
one of its controls gets the focus.

I am sure that no background code runs as different records get the
focus
unless something is changed. I've tried repaint instead of refresh
which
was
used after the value of the ParentForm control is set from the
OnCurrent
Event of the subform. Requery looses the focus alltogether so its
useless
in
this case.




RobGMiller










 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.