473,377 Members | 1,153 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,377 software developers and data experts.

Color change in ActiveControl

I have a form with 3 related fields. If data is entered into 1 field, the
other 2 related fields are updated automatically. I would like to indicate
on the form into which field the data was initially entered by a) changing
the color of the text or b) by changing the color of the background. Have
tried using Screen.ActiveCell.Backcolor = xxx upon entering the cell but
have not had any luck. Would appreciate help.

Chuck
Nov 13 '05 #1
7 4940
MLH
I use this for changing color of a control OnGotFocus...
=Change2Green("Forms![frmCustEntryfrmVehicleEntryForm]![OwnerID]
OnGotFocus event procedure")

I use this for changing color of a control OnLostFocus...
=Change2Gray("Forms![frmVehicleEntryForm]![OwnerID] OnLostFocus event
procedure")

Maybe you can modif them somehow to get what you want. Here's a basic
color changer procedure...

Function Change2DarkGreen()
Dim MyControl As Control
Set MyControl = Screen.ActiveControl
MyControl.BackColor = 32768

'This function can be called from most anywhere. However, when
first opening a form
'and going to the very first control - if called, this code
pukes. You have to handle
'that a different way: Me![ControlName].BackColor=65280 works
just fine when entered
'as code-behind-form on the OnGotFocus property for the
control. This is ONLY for the
'very first control on a form. All subsequent controls can
call this function without
'any problem whatsoever!

End Function

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\
On Sat, 18 Jun 2005 09:46:18 -0700, "Chuck" <ch*****@comcast.net>
wrote:
I have a form with 3 related fields. If data is entered into 1 field, the
other 2 related fields are updated automatically. I would like to indicate
on the form into which field the data was initially entered by a) changing
the color of the text or b) by changing the color of the background. Have
tried using Screen.ActiveCell.Backcolor = xxx upon entering the cell but
have not had any luck. Would appreciate help.

Chuck


Nov 13 '05 #2
MLH
Sorry, Chuck...
Better use this format for the color changer procedure. I gave
you an earlier one that I don't use much any more.

Function Change2Gray(CallingProcedure As String)
On Error GoTo Change2Gray_Err

Dim MyControl As Control
Set MyControl = Screen.ActiveControl
MyControl.BackColor = 12632256

Change2Gray_Exit:
Exit Function

Change2Gray_Err:
Dim r As String, Z As String, Message3 As String
r = "The following unexpected error occurred in Function
Change2Gray() when called from " & CallingProcedure & ":"
Z = CRLF & CRLF & Str$(Err) & ": " & Quote & Error$ & Quote
Message3 = r & Z
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume Change2Gray_Exit

End Function

Nov 13 '05 #3

MLH,

Reallu appreciate your help. Tried to use your input,but no success.
Wanted to attach the trial mdb, only 4 fields, 160K unzipped (14K
zipped) but don't know how. If you can either tell me how, or send your
email address I'll get it to you asap.

Chuck

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #4
MHL,

Found out what the problem was. The back color only shows in Form View.
I have been in Datasheet View. I wanted to see, in Datasheet View, the
initial input field highlighted, somehow, in every initial input field
for all records. Is that possible?

Chuck

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5
MLH
You've got me there. I have never tried datasheet
view. Don't know why not. Just never thought I
needed it for anything.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

On Sat, 18 Jun 2005 23:15:00 GMT, Chuck Goldstein <ch*****@acm.org>
wrote:
MHL,

Found out what the problem was. The back color only shows in Form View.
I have been in Datasheet View. I wanted to see, in Datasheet View, the
initial input field highlighted, somehow, in every initial input field
for all records. Is that possible?

Chuck

*** Sent via Developersdex http://www.developersdex.com ***


Nov 13 '05 #6

Thanks, MLH. I appreciate your responses, nonetheless. At least I now
know how to do this of cells in Form Mode. If I ever find out how to do
it in Display ode, I'll let you know.

Chuck
*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #7
MLH
Alright.
Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: James Ramaley | last post by:
I am creating a ListView control at run-time and show it on my form. The control appears on the screen and responds to keyboard input. However, the form's ActiveControl method returns a reference...
2
by: Sam | last post by:
Hi, I have a MDI Application. The MDI parent contains a treeview control, and the childform contains a textbox. If I leave the textbox by clicking on the treeview, then...
0
by: Greg | last post by:
I'd like to know which contol the focus of a cell in a datagrid is being lost to. Querying ActiveControl.Name within the LostFocus event gives me a blank string, instead of the name of a button I...
4
by: Aphazel | last post by:
I got serveral textboxes in a form and want to copy/cut/paste text to clipboard from currently selected (focused) textbox. It's simple to cut/copy/paste when using specified control directly ie...
0
by: Rick Shaw | last post by:
Hi, I need to determine if the current ActiveControl is ReadOnly. I need to find this out in the Form's keypress event. How do I go about doing this? Also, I have a control this is a...
2
by: Bob Darlington | last post by:
When I run the following code from a continuous form's Current event: Set ctrl = Me.ActiveControl I get an error 2474 - 'The expression you entered requires the control to be in the active...
4
by: Jon Slaughter | last post by:
I've created some custom controls and forms that allow the feature to temporarily transfer focus to a control that has been entered by the mouse. Everything seems to work fine but the problem I...
1
by: unknown; | last post by:
hello, i've got a question about active control. i'm buillding an application witch uses me.activeControl a few times to check some things. Now something strange happends.. when i click on...
3
by: nano2k | last post by:
Each form has its ActiveControl property, but no ActiveControlChanged event to signal that the active control has changed (like ParentChanged event). I tried to trick the form by declaring this...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.