cancel
Showing results for 
Search instead for 
Did you mean: 

Access XP

N/A

Access XP

:shock:

HI all,

I am using access XP and I need help with the fields.

Whay I am trying to do in the database is have colours attached to the fields. ie if the code 1 is inserted in the cose field I want the box to go blue, red if the code 2 is put in. I don't know if this is possible and I can't find anywhere on the net that can give me this info.

Cheers in advance

Sam
3 REPLIES
N/A

Access Dbase

Hi,
I am NOT familiar with AccessXP directly but I have experience of using numberous other previous access versions of this product to some depth. I think you will find that any element in access database has a properties sheet which allows you to change just about any element in your design. Screen design elements do tend to be the most flexible too, so I would be completely amazed if you couldnt change to field colour your talking about.

**Its definately worth your while looking on the Microsoft website and searching for documentation on this subject. Failing that most versions of access (I cannot believe the XP version will be any different) come with pretty detailled online documentation & searchable help files. Have you searched on the subject in accessXP help system?

Ivan
N/A

Access XP

Hi Sam,

Sorry, you've got another non-Access XP expert on the case! I do fiddle around with databases for my job but the unusual thing about Access as opposed to a simple (or complicated!) relational database is its tight integration with the display of data through the use of built-in forms. Ok, that's my excuses out of the way!

There might be a very simple way to do this with Access but I don't know it. Approaching from a more traditional perspective it seems to me that you'd need at least an additional table containing two columns: An integer column corresponding to the value that should have a special colour associated with it and another integer column containing the desired colour value. I'd store this colour in its Hexadecimal representation but Access would probably understand a string such as "Blue" or "Green" when setting the background colour of a text box so you could (probably) optionally store the colour in this form. Sorry but my lack of Access experience is showing here.

Once you've filled in this table with your preferred colours you can define an "After Update" event for your text box (right click on the box, select "Properties", scroll down to find "After Update", click on "..." and select "Code Builder") which should (probably!) be fired whenever the value of the box changes, as would happen when you move from one record to another.

The "After Update" event needs to be written in Visual Basic from what I can see, possibly with a choice of some other languages so if you're not confident about wrting code you should stop here and seek alternative advice!

The code could be made to check the value of the contents of the text box (1, 2, 3 etc) and query the "Colours" table to retrieve the colour associated with that number. It's then a simple matter to set the background colour of the text box to the retrieved colour from within the "After Update" script.

This may be a horrendously complicated way of going about a simple Access task but it'd work (probably) and might be fun. Well ok, it would work (probably) Smiley

Jon.
N/A

Cheers

Hi,

Thanks for the responce, I am a complete novice but I get the gist. I will give it a try and let you know if it works. As for the fun part well.......

Cheers again

Sam