XN--SZS37G.COM
welcome to my space
X
Article search:  
 HOME   Ms Access Tutorial - How to Use Color Coding to Enhance your Applications
Ms Access Tutorial - How to Use Color Coding to Enhance your Applications
Published by: anonym 2008-10-12

.NET imaging SDK - faster .NET imaging, PDF editing, CAD Vector ::
NET applications faster with Visual Studio and the .NET Framework. Use our time with more code samples in ART and Processing namespaces; Enhance your
http://www.accusoft.com/products/imagegear/ignet/version_history.asp
HOME
Please take a look at this powerful technique to add advanced color coding logic to your forms.

Color coding adds value to a form as it easily directs the users eye to critical data. This is a powerful technique that allows a user to quickly evaluate a pages of data for errors or warning information.

Access 2000 to Access 2003 has a limit of four colors you can use for each field on a continuous form. Using the condition code methos described in this tip, there is no limit to the logic you can apply to set the field conditions to one of the four color options.

Create a table name it ColorCoding
Enter the following fields (without the numbers)
1] CntrID as Autonumber, make it the primary key field
2] Cntname as text
3] WorkDesc as text - the data should either be min or maj
4] EMR as number, single - the data should be any integer between 1 and 10
5] aggdate as date/time
6] aggamnt as currency
7] wcompdate as date/time
8] wcompamnt as currency
9] concode as number, long integer this field will be calculated so leave it blank.

Enter some data in the table for testing.

Create a form continuous style form using the ColorCoding table as the data source.
FileMaker Pro 5::
Multimedia "Container" Fields--Enhance your files easily by integrating video from other ODBC-compliant applications like Microsoft Access or Oracle.
http://sonic.net/mnitepub/pccafe/reviews/filemakerpro5/filemakerpro5.htm
HOME
Starting Visual Studio 2003 and Creating your Project::
File Format: PDF/Adobe Acrobat - View as HTMLThis tutorial will show you how to use the STK Object Model in a custom Compute Access. In this section you will add code to your application to
http://www.agi.com/downloads/resources/download/tutorials/pdf/stk8/ObjectModel.pdf
HOME
Add a form header/footer.
Put a form title in the form header section of the form (optional).
Use the other tab on the properties form and give each field the same name as its control source. So, name the [EMR] field EMR for example. Then you Can use the field names like variable names when you create VBA code.
Add all the fields to the table and align the in one row with the field labels above each field but in the form header sectionof the form.
This should leave one row of fields in the detail section of the form.
Put a button in the footer with the caption refresh.

In design mode on your form, choose Format / Conditional Formating.
Use the Mid command to check a character in the condition code and set your condition colors. Look at the [EMR] field. It is the fourth field from the left. The Mid command directs Access to check the field concode in the fourth chracter place for a span of 1 character for the value of 3.
Silverlight Tutorials::
Now run your application your silverlight control will be in transparent. microsoft access 2007 hosting MS Access 2007 Supported
http://www.silverlighttutorials.blogspot.com/
HOME
Bring life to your website with JavaScript::
Code export preserves the color coding and formatting: it makes your that you can not only play with, but use for free to enhance your web pages.
http://www.c-point.com/javascript_editor.php
HOME
Set the conditions like this

Leave the default formatting set to white background and black font color.

Expression is Mid([concode],4,1)=3 Pick a color -- I use Red for 3 or an failing condition

Expression is Mid([concode],4,1)=2 Pick a color-- I use yellow for 2 or a warning condition

Expression is Mid([concode],4,1)=1 Pick a color -- I use green for 1 or a passing condition

Repeat this for each field you wish to set conditions on. Note that each character of the condition code starting from left to right will represent a respective field from left to right. So, a 3 in the 2 place on the condition code field will set the CntName field to red. See the field numbers above. Subsequent fields follow the same sequence.

One more example for the [aggdate] field the condtional format would look like:
Expression is Mid([concode],5,1)=3 Pick a color. This

The condition code field, [concode], values are created with any logic that you want to assign to it. In this example I am using eight fields so the conidition code is eight characters wide and each character could be either a 0,1,2, or 3. So it may look like this 10112321. Now using the mid command above, the fourth character is a 1 so the condition for the fourth field,[ EMR], would be a 1 which conditions to green.

Once you have the form designed and tested, you may want to go back and set the concode field to invisible. Your users dont need to see that data.

After you have created the form apply the following code. You can cut and paste this right into the form if you used the same field names described without any typing.

Cut here --------
Option Compare Database
Dim rec As DAO.Recordset
Dim db As Database
Getting Started: Searching eBay Using FindItemsAdvanced::
In this tutorial you will create a JavaScript application that searches the eBay .. You can think of this as a way to enhance your existing business or
http://developer.ebay.com/DevZone/javascript/docs/HowTo/FindItemsAdvanced/GettingStartedSearchingeBayUsingFindItemsAdvanced_js.htm
HOME
VB Project Description::
(I recommend MS Access.) Visit some real reservation systems on the web, So basically just drag-and-drop controls to enhance your interface and set a
http://www.cs.umd.edu/class/spring2001/cmsc434-0101/vb.html
HOME

Public Function SetConCode()
On Error GoTo erout
Dim xcode(10) As Integer, x As Integer, CCode As String, y As Integer
xcode values 1 = green, 2 = yellow, 3 = red, 0 =white
Use the next line if you have hundreds of records and dont want to wait on the screen to update
DoCmd.Echo False
Set the field counter to Zero
x = 0
increment the field counter as you go
x = x + 1 Step 1
If IsNull(CntrID) Then
xcode(x) = 0
Else
xcode(x) = 1
End If

x = x + 1 Step 2
If IsNull(Cntname) Then
xcode(x) = 0
Else
xcode(x) = 1
End If

x = x + 1 Step 3
If IsNull(WorkDesc) Then
xcode(x) = 0
Else
xcode(x) = 1
End If

x = x + 1 Step 4
If IsNull(EMR) Then
xcode(x) = 0
ElseIf EMR 3 And EMR <= 7 Then
xcode(x) = 2
Else
xcode(x) = 3
End If

x = x + 1 Step 5
If IsNull(aggdate) Then
xcode(x) = 0
ElseIf aggdate = Now() And aggdate <= Now() + 10 Then
xcode(x) = 2
Else
xcode(x) = 1
End If

x = x + 1 Step 6
You can use any amount of logic you need to set the condition you want and then drive
the conditional formatting to the color you desire.
In this example I use two sets of condition values depending on the value of another field alltogether.
If IsNull(aggamnt) Then
xcode(x) = 0
GoTo aggout
End If
If WorkDesc = min Then
If aggamnt = 1 And aggamnt <= 5 Then
xcode(x) = 2
Else
xcode(x) = 1
End If
GoTo aggout
ElseIf WorkDesc = maj Then
If aggamnt = 3 And aggamnt <= 7 Then
xcode(x) = 2
Else
xcode(x) = 1
End If
End If
aggout:

x = x + 1 Step 7 wcompdate
If IsNull(wcompdate) Then
xcode(x) = 0
ElseIf wcompdate = Now() And wcompdate 1 Then
xcode(2) = 3
End If

Build conCode field values from xcode values collecting the value of X from left to right

y = 0
For y = 1 To 8
If y = 1 Then
CCode = xcode(y)
Else
CCode = CCode & xcode(y)
End If
Next
MsgBox setconcode finished
concode = CCode
erout:
Debug.Print Err.Description
DoCmd.Echo True

End Function

Run the SetConCode function after each field is updated

Private Sub addamnt_AfterUpdate()
SetConCode
End Sub

Private Sub aggdate_AfterUpdate()
SetConCode
End Sub

Private Sub Cntname_AfterUpdate()
SetConCode
End Sub

Private Sub EMR_AfterUpdate()
SetConCode
End Sub

Private Sub Form_Open(Cancel As Integer)
Loop through all the records setting the concode values when the form is opened to check date values.
Dim x As Integer

x = 1
Set rec = Me.Recordset.Clone
rec.MoveLast
If rec.RecordCount = 0 Then
MsgBox NO Records Found
End If
rec.MoveFirst
DoCmd.GoToRecord acDataForm, CondCodes, acFirst
For x = 1 To rec.RecordCount - 1
If x = rec.RecordCount Then
GoTo getoutloop
Else
SetConCode
DoCmd.GoToRecord acDataForm, CondCodes, acNext
End If
Next
getoutloop:
rec.Close
End Sub

Private Sub set_Click()
Loop through all the records setting the concode values
Dim x As Integer

x = 1
Set rec = Me.Recordset.Clone
rec.MoveLast
If rec.RecordCount = 0 Then
MsgBox NO Records Found
End If
rec.MoveFirst
DoCmd.GoToRecord acDataForm, CondCodes, acFirst
For x = 1 To rec.RecordCount - 1
If x = rec.RecordCount Then
GoTo getoutloop
Else
SetConCode
DoCmd.GoToRecord acDataForm, CondCodes, acNext
End If
Next
DoCmd.Echo True turn echo back on if you turned it off
getoutloop:
rec.Close
End Sub

Private Sub wcompamnt_AfterUpdate()
SetConCode
End Sub

Private Sub wcompdate_AfterUpdate()
SetConCode
End Sub

Cut Here --------------

You can download the example database file from our site at www.biomationsystems.com. Look for the Access Tips link.

This example was created with Access 2002. There may be better ways to accomplish the same thing, but this works well for us. You will need to set the VBA references to include microsoft DAO 3.6

This should do it. You can find the complete example on our web site with a sample database included.

Please note that this is a powerful and valuable tip that can help you set your database applications apart and make your users want more. We work hard to provide these tutorials and would very much appreciate you visiting our site and taking a look at our site and giving us some feedback.

We develop custom applications that solve complex data problems for businesses of all sizes. Our users ask us back because we provide great value. We are looking for partners in process improvement.

If you know of anyone who would benefit from this type of Access help, please feel free to pass this email along.

We have combined two of our favorite utilities into one great limited time special offer. The email tool that we use to keep in touch with our customers and a backup scheduler that allows you to schedule your data to be safely backed up in two different locations.

One Day...

Jon E. Watson
President, BioMation Systems, Inc.
Look for our products and services at www.biomationsystems.com




Pre-Article:Building Self Confidence
Next-Article:Medical Malpractice Compensation Claim


About us -Site map -Advertisement -Jion us -Contact usExchange linksSponsor us
Copyright© 2008 xn--szs37g.com All Rights Reserved
Site made&Support support@xn--szs37g.com    E-mail: web@xn--szs37g.com