changing font color

G

Guest

Is it possible to change the font color on a form for different users? When a
specific user types data into certain fields I want the color to be different
for that user. But if another user types data into that field as well I want
that color to be different. Can this be done?

Example: I have a comment field and when 1 user types notes in that field I
want that text to be one color and if another user types notes in that field
I want just that text a different color.
 
G

Guest

Providing there is somewhere on the form the username ( txtUser) is shown....

Private Sub MemoField_AfterUpdate()
If Me.txtUser = "XYZ" Then
Me.DCShortName.BackColor = vbRed
End If
If Me.txtUser = "ABC" Then
Me.DCShortName.BackColor = vbYellow
End If
End Sub

Also I would put this on the load of the form to maintain the process

Private Sub Form_Load()
If Me.txtUser = "XYZ" Then
Me.DCShortName.BackColor = vbRed
End If
If Me.txtUser = "ABC" Then
Me.DCShortName.BackColor = vbYellow
End If
End Sub


Good luck
 
G

Guest

Sorry I forgot to add that the colour will change if the memo field is
changed by another user (I think this is what you are looking for). If you
want to keep the colour of the user who 1st made the changes the code will
not work. You would need to base txtUser on a control bound to a table
field, user login, etc.

Oh and in the code DCShortName is the field that will change. Some a "very"
odd reason all our company memo fields are called ShortName with 2 capital
letters to start (don't ask it started years ago)
 
G

Guest

Hi Wayne,
Thanks for your help. I am actually looking to keep the color of the user's
text in the memo field. But if another user adds text to that memo field I
want only that text to be a different color. So the only thing I would need
to change is add a bound control to a table where my user's names are kept?
How will it know which text in that memo field is from whic user?
 
R

Rob Parker

PMFJI,

Sorry, Secret Squirrel,

There is no way that you can set different colours to different portions of
text in a memo field, based on which user originally entered the text.

If that's what you must have, you'll need to redesign your database to keep
comments from each user in a separate record, in a separate table. You
could then display each record in a subform, using conditional formatting
(for less than three users) or coding to change the text colour for input
from different users; you would also need, as I think Wayne mentioned in a
previous post, to record the user who enters each record.

In simple terms, what you are asking cannot be done. Any possible
workaround would entail considerable work to redesign your database. If
that's what you're prepared to do, then work on it, and post back (with a
new subject line) when you hit problems. I'm sure someone here will help -
but not me, this seems like WOFTAM to me ;-)

No offence intended.

Rob
 
G

Guest

I wasn't sure if it could be done and I was leaning towards it not being
possible. I will find an easier way to do this. Thanks for your input.

BTW - what is WOFTAM?
 
G

Guest

Hi

Sorry I missread your 1st post. Rob is correct, you can't do what you asked.

I think you are just looking for a way to see who placed some bit of the
Memo ??

If thats right why not have a popup for to add append text to the memo
field. If you have a combo on the form with a list of users names (or some
other method of seeing who is working on the form) it would be very simple.

eg.
Try this on a new form to see what happens.

Create "2" memo boxes and a combo
The 1st memo is based on a table field
The 2nd memo is unbound
The combo is up to you (it could even be a text box - but I think that will
go wrong ?)

add this to the after update of the 2nd memo

Private Sub MemoName2_AfterUpdate()
Me.MemoName = "This bit was put in by" & ComboName & Chr(13) + Chr(10) &
Me.MemoName2 & Chr(13) + Chr(10) & Me.MemoName
End Sub

I think this should do what you want. - Of course I have not put memoname2
on a popup - this was just to point you in the right direction.

Good luck
 
P

Pete D.

You could also add on the before update of the field append the user name or
initials at the end of the text, assuming that you have that stored
someplace or have pulled it from the server. Pete D.
 
R

Rob Parker

Secret Squirrel said:
I wasn't sure if it could be done and I was leaning towards it not being
possible. I will find an easier way to do this. Thanks for your input.

BTW - what is WOFTAM?
<snip>

"Waste Of Flaming Time And Money"

Note though, that the Internet Acronym Server
(http://silmaril.ie/cgi-bin/uncgi/acronyms) gives a slightly different
wording ;-)

Hope you fix your problem,

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top