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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding colour to a table, How? 2

Status
Not open for further replies.

reallyovermyhead

Technical User
Jul 29, 2004
1
GB
Hi,
I am new to Access and was wondering.............

Does anyone know if it is possible to define the background colour of a row, by the contents of the first cell in that row?

I have set up a database (table) with a drop down list in the first column, and I would like the colour of the row to change depending on which option is chosen from the drop down list.

If this is not possible - but there is another way to achieve the same outcome, please let me know

Thanks
 
Since you shouldn't let your users have access to the tables, you shouldn't worry about the format there. Also, using table level lookups is not encouraged, as they have a tendency of creating future headaches. Here's a link on that The Evils of Lookup Fields in Tables.

Now, where to conduct formatting?

In the forms, where you allow the users to manipulate the data. Look into conditional formatting (format menu on Access 2000+ versions), choose "expression is" in the first dropdown, then enter the expression you need to evaluate in the next box:

[tt][txtID]=5[/tt]

Enter the relevant formatting, and...

Welcome to Tek-Tips!
To get the most out of the membership, take a look at faq181-2886. There are more Access fora, see the Related Forums box at right...

Good Luck!

Roy-Vidar
 
Roy

That works for forms (which have named controls) but will it work for datasheets (in forms or queries)?

I don't think you can cantrol this. Mind you I've never got beyond Access 2000.

 
BNPMike:
Being somewhat outlandish, might impact my English, but I did my best trying to relate formatting (in particular conditional formatting) to forms (I should perhaps have mentioned reports, too?), and discourage formatting in tables and queries. Hope this will clear up any misunderstanding.

I've found conditional formatting to work on single forms, continuous forms and forms in datasheet view (I don't use datasheet view, but have performed some small tests).

Since I'm a firm believer in not exposing the tables and queries to the users (or vice versa), I've never bothered to find out what kind of formatting might be available there, but should you have any problems using conditional formatting in datasheet view of forms, please post some information to work with, and I'll power up my Office 2000 computer.

BTW - here's the last time I tested conditional formatting on a form in datasheet view in a2k thread705-781496.

Roy-Vidar
 
Roy

I just tried to follow the instructions in your previous post and low-and-behold you do get a dialogue box that works on a datasheet sub-form.

Only problem is, when I save the form, Access terminates....

 
Hey. It works.

There's an extra pint on me at lunchtime, Roy. In lieu iof that - a star.

 
hmmmmmmmmmmmmmmmmmm ... never got around to trying to use conditional formatting to set a record (row) on a Form (or Report) to more than two specific values (Bold / Not Bold; color A / Color B etc) I did look at it once, but the syntax doesn'y appear to support the variation in the format, as 'Expression' evaluates to a BOOLEAN, and only the single format expression is available. Am I incorect here? Hopefully so, and someone can / will post a small snippet illustrating how to write the expression to evaluate to a (mnon-boolean) value and use the result to select various formats.





MichaelRed
mlred@verizon.net

 
Michael

This reminds me of Dr Johnson who on seeing a dog dancing on its hind legs said

" It's not that it is done well; it is that it is done at all"

 
or ... from my perspective ... it is like MS in hte generic. Whatever they "do" it takes at least three tries to get it to work "reasonably" well. quite normal (human normal anyway). Yes, they (MS) has borowed and somewhat modified 'work-around code' for a feature which could be useful, and implemented it, but fall somewhat short of the complete functionality one might want (expect?) from the name given to it (Format, in most connotations implies more than a binary choice). In the next "release" there will be some additional (possibly optional) parameters, and by the second next release a reasonale implementation?





MichaelRed
mlred@verizon.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top