473,440 Members | 1,763 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,440 software developers and data experts.

Setting a simple condition for a field

I am trying to create a simple application to track the "in" and "out"
of a group of employees. The In and Out field is a drop down. When it
is set to "in" I want the background of the filed to be green, and when
it is set to "out" I want the back ground to appear red. I would
appreciate some instruction and or sample VB code for such an
operation.

Thanks,
Tom B

Nov 23 '05 #1
6 1243
If Me!InAndOutField = "In" Then
Me.Detial.BackColor = "65280"
ElseIf Me!InAndOutField = "Out" Then
Me.Detial.BackColor = "255"
Else
Me.Detial.BackColor= "-2147483633"
End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee. Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Need appointment scheduling? Need
room reservations scheduling? Need employee work scheduling? Contact me!

"Tom B" <tj********@comcast.net> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am trying to create a simple application to track the "in" and "out"
of a group of employees. The In and Out field is a drop down. When it
is set to "in" I want the background of the filed to be green, and when
it is set to "out" I want the back ground to appear red. I would
appreciate some instruction and or sample VB code for such an
operation.

Thanks,
Tom B

Nov 23 '05 #2

"PC Datasheet" <no****@nospam.spam> wrote in message
news:Gk****************@newsread3.news.atl.earthli nk.net...
If Me!InAndOutField = "In" Then
Me.Detial.BackColor = "65280"
ElseIf Me!InAndOutField = "Out" Then
Me.Detial.BackColor = "255"
Else
Me.Detial.BackColor= "-2147483633"
End If


He meant to say Detail.

Nov 23 '05 #3
Thanks, Randy!
It's good to see a courteous response by you!!!!!

Steve
"Randy Harris" <ra***@SpamFree.com> wrote in message
news:wy****************@newssvr24.news.prodigy.net ...

"PC Datasheet" <no****@nospam.spam> wrote in message
news:Gk****************@newsread3.news.atl.earthli nk.net...
If Me!InAndOutField = "In" Then
Me.Detial.BackColor = "65280"
ElseIf Me!InAndOutField = "Out" Then
Me.Detial.BackColor = "255"
Else
Me.Detial.BackColor= "-2147483633"
End If


He meant to say Detail.

Nov 23 '05 #4
Thanks for the quick reply and the code worked beautifuly. However I
had a mistake in my description. I want only the back color of the text
box to change, not the color of the entire form.

Thanks again for the help,
Tom

Nov 23 '05 #5
"Tom B" <tj********@comcast.net> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Thanks for the quick reply and the code worked beautifuly. However I
had a mistake in my description. I want only the back color of the text
box to change, not the color of the entire form.


The syntax would be "Me.txtMyTextBox.BackColor = " where txtMyTextBox is the
name of your control.

Keith.
www.keithwilby.com
Nov 23 '05 #6
Thanks Keith

Nov 23 '05 #7

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

Similar topics

10
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
8
by: John Welch | last post by:
I have a command button with the following code: DoCmd.OpenForm "frmSearchAssignments", , , "SearchAssignmentID = 1" (SearchAssignmentID is the PK, auto number) When it runs, the form opens but...
3
by: Mike Eaton | last post by:
Hi there, I've got what I hope is a simple problem to solve... Here's the back story: I have a windows form. On the form is a panel containing three textboxes. Also on the form is a text box...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
by: MLH | last post by:
I have a table, tblCorrespondence, that has been losing its KeyField setting. The field is named CorrespID and is an AutoNumber type field. This has happened in A97 on 3 occasions recently I...
5
by: DaveLock | last post by:
Hi, I have 3 tables of data created from different sources, each with the same 2 fields & I wanted to fill the 2nd field of another table with the data on condition. The condition is because...
3
by: myemail.an | last post by:
I use Access 2007 and create queries with a number of calculated fields/expressions (I'm still a novice so please forgive me if my wording is imprecise...), like: MyCalculation = Field1 - Field2. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.