changing cell back color in datasheet

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

Guest

Hi,

I can't seem to figure this out even after trying answers in other threads.

I have a subform datasheet.

When I click on a cell in a particular column, I would like the background
color
for only that cell to change color for the current record.

me.column1.backcolor = mycolor
where color is a long datatype and I have a value does not work.
It does nothing.

I also suspect that if it did work, every record in that column would turn
that color and not just for the particular record.

please advise

thanks

Chris
 
Chris said:
I have a subform datasheet.

When I click on a cell in a particular column, I would like the background
color
for only that cell to change color for the current record.

me.column1.backcolor = mycolor
where color is a long datatype and I have a value does not work.
It does nothing.

I also suspect that if it did work, every record in that column would turn
that color and not just for the particular record.


Right, that will not do what you want on a form in datasheet
or continuous view.

Instead, use Conditional Formatting (Format menu). Just
select the "Field has Focus" condition.
 
thanks for reply.

I think I failed to mention that I want the background color to stay that way.

Basically I am trying to select a whole bunch of records and programatically
do something with all the records that have a particular cell for a
background color.

I am looking to use a different approach than the checkbox in a datasheet or
checkbox in a continous form, both of which are extremely involved solutions.
 
The only way you're going to get different colors on
different rows in datasheet is to use Conditional
Formatting. How you accomplish what you want may be
"extremely involved" from your point of view, but that's a
highly subjective opinion.

I think you will need to start with Albert's clever use of a
collection to simulate a multi-select feature on a form
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
You can then create another function to check the collection
and return True or False and use that function in the
conditional formatting expression. Personally, I think this
an elegantly simple approach.
 
Yes, Albert Kallals example is excellent however it does not work in
datasheet mode, it only seems to work in continous forms.

Is it possible to have checkboxes and command buttons in a datasheet, I
have'nt been able to do it.

please advise.

Marshall Barton said:
The only way you're going to get different colors on
different rows in datasheet is to use Conditional
Formatting. How you accomplish what you want may be
"extremely involved" from your point of view, but that's a
highly subjective opinion.

I think you will need to start with Albert's clever use of a
collection to simulate a multi-select feature on a form
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
You can then create another function to check the collection
and return True or False and use that function in the
conditional formatting expression. Personally, I think this
an elegantly simple approach.
--
Marsh
MVP [MS Access]

I think I failed to mention that I want the background color to stay that way.

Basically I am trying to select a whole bunch of records and programatically
do something with all the records that have a particular cell for a
background color.

I am looking to use a different approach than the checkbox in a datasheet or
checkbox in a continous form, both of which are extremely involved solutions.
 
Sorry, Chris, I forgot about the issue of the command
button. You can have a check box on a datasheet but not a
command button. I still think you should use a continuous
form instead of a datasheet, continuous forms are much more
versatile.

It's not really necessary to use the transparent button on
top of a check box. You can use the record selector and the
form's Click event instead.

The conditional format expression would just be a call to
the IsChecked function.
 
I very much appreciate your responses.

One last question, I think.

My supervisor is pretty dead set on using a datasheet not a continuous form.

Hence, the idea was to have 2 subforms beside each other.
the left subreport contains a continous form with all the checkboxes and the
unique
record(invisible).

the right subreport contains the unique record numbers again (invisible)
plus all the visible columns.

the idea would be to have a vertical scroll on the right subreport that would
simultaneously also move the left subreport up and down through the record set

both record sets would use the same query so they would be in sync on first
load.

is this possible? to sync both reports "EXACTLY": very important. using only
one
horizontal scroll?

please advise.
Marshall Barton said:
Sorry, Chris, I forgot about the issue of the command
button. You can have a check box on a datasheet but not a
command button. I still think you should use a continuous
form instead of a datasheet, continuous forms are much more
versatile.

It's not really necessary to use the transparent button on
top of a check box. You can use the record selector and the
form's Click event instead.

The conditional format expression would just be a call to
the IsChecked function.
--
Marsh
MVP [MS Access]

Yes, Albert Kallals example is excellent however it does not work in
datasheet mode, it only seems to work in continous forms.

Is it possible to have checkboxes and command buttons in a datasheet, I
have'nt been able to do it.
 
Well, that may be possible using APIs and who knows what,
but I wouldn't want to be the one that had do it. Even if
you could cobble something like that together, murphy would
have a field day playing with its compexities :-(

Why the bleep don't you just do Albert's thing on a single
continuous subform and be done with it. Just between you
and me, I don't think your supervisor knows, errrr, uhm,
ahh, his nose from an Access form ;-)
 
I suspected it'd be a messy thing to do. If I can't convince him to use
continous form
then I'll have to make it a flexgrid which basically means building the
functionality of
a updateable snapshot datasheet and a continous form all in one.

thanks for the advice.

Marshall Barton said:
Well, that may be possible using APIs and who knows what,
but I wouldn't want to be the one that had do it. Even if
you could cobble something like that together, murphy would
have a field day playing with its compexities :-(

Why the bleep don't you just do Albert's thing on a single
continuous subform and be done with it. Just between you
and me, I don't think your supervisor knows, errrr, uhm,
ahh, his nose from an Access form ;-)
--
Marsh
MVP [MS Access]


One last question, I think.

My supervisor is pretty dead set on using a datasheet not a continuous form.

Hence, the idea was to have 2 subforms beside each other.
the left subreport contains a continous form with all the checkboxes and the
unique record(invisible).

the right subreport contains the unique record numbers again (invisible)
plus all the visible columns.

the idea would be to have a vertical scroll on the right subreport that would
simultaneously also move the left subreport up and down through the record set

both record sets would use the same query so they would be in sync on first
load.

is this possible? to sync both reports "EXACTLY": very important. using only
one horizontal scroll?
 
Back
Top