Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Background Color of a field in Datasheet View

Status
Not open for further replies.

qmacg

Technical User
Aug 20, 2001
47
US
Hey is there a way to change the background color of a field while a subform is in Datasheet View?? I can slap some VBA code together, but before I bother, wanted to know if the properties of a field can be changed on a field other than the normal view of MS Access Forms.
 
How are ya qmacg . . .

Have you tried [blue]Conditional Formatting?[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Have you considered using conditional formating and using a continuous form instead of datasheet?


Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
I believe the conditional formatting would only be available for continous forms mode. I'm not using that mode, i'm using datasheet view. Is there a way to alter the text formatting in datasheet view?
 
Yes conditional format can be used on a form in datasheet view. You have to use conditional formatting and not change the background in code. If you do not use conditional formatting then any change to one record will change all the records.
 
Conditional formatting does not work in datasheet view. As previously stated us a continuous form made to look like a datasheet.


Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
ProgramError,
I think you are in error.
Conditional formatting does not work in datasheet view. As previously stated us a continuous form made to look like a datasheet
Seems to work just fine since Access 97. I am running 2003 and I am looking at a datasheet view with conditional formatting no problem. Try it.
 

Conditional Formatting does indeed work for Datatsheet Views in v2003. I think the relevant question here is what version the OP is using, as well as ProgramError.

I can't swear to it, but somewhere in the deep,dusty regions of my addled brain, I seem to recall that in the first incarnation of Conditional Formatting, in v2000, that it may have been only available for Continuous or Single View forms.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
qmacg . . .

Conditional Formatting works in all views! [thumbsup2]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hey thanks for all the help, but i'm not using continuous forms in any way. I'm using datasheet view.
I tried using the code below even on the "OnEnter" event in datasheet view and the color did not change. When in continous it works, but that's not what i'm trying to accomplish here. I wanted to setup conditions for certain fields to turn Red, Yellow .etc, but if the field will not change color in datasheet view, i'm not going to even bother going further with this...

Dim frmCurrentForm As Form
Set frmCurrentForm = Screen.ActiveForm
'MsgBox "Current form is " & frmCurrentForm.Name
frmCurrentForm.SystemInteractwith.BackColor = 255

 
Again, simply use Conditional Formatting (No VBA needed).

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
qmacg . . .

In a form, the [blue]Default View[/blue] property sets the view you desire. There are three possible views:
[ol][li]Single Form[/li]
[li]Continuous Forms[/li]
[li]Datasheet[/li][/ol]
I repeat ...
TheAceMan1 said:
[blue]Conditional Formatting [purple]works in all views![/purple][/blue]
If by chance your working directly with a table [blue]instead of thru a form[/blue], it can't be done!

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
qmacg . . .

Hit submitt too soon.

According to your last post your not using conditional formatting. In form design view from the menubar its [blue]Format[/blue] - [blue]Conditional Formatting...[/blue]

[blue]PHV[/blue] has already hinted at this!

[blue]Your Thoughts! . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Forgive me folks, I did not realize it was an option from the Menu as TheAceMan1 pointed out. I was thinking to access the control through VBA with "Conditons" to format (i.e. If txtBox3.Value=Summer then txtBox3.BackColor=Red(or 255).
So tell me something here... Since I can do that, is there anyway to see the code behind it that is changing the colors/Fonts? How far back does this Conditional Formatting go in the versions of MS Access? Thanks again for all of your assistance.
 
Conditional formatting came out in A2K. I know that in A2K it worked on forms and reports in single and continous view, but not sure if in A2K it worked in a datasheet view (or that may have come out in A2003).

When you use conditional formatting it does not store any code that is visible to the user, you have to look at it from the menu "Format", "Conditional Formatting".

You can write conditional formatting code, but that is different than what you are trying to do (which will not work in a continous form view). There is a "formatconditions" object (I think A2003 and beyond)
 
Ok thanks again for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top