Quick Search


Tibetan singing bowl music,sound healing, remove negative energy.

528hz solfreggio music -  Attract Wealth and Abundance, Manifest Money and Increase Luck



 
Your forum announcement here!

  Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums > Post Your Free Ads Here in English for Advertising .Adult and gambling websites NOT accepted. > Post Your Products & Services Here

Post Your Products & Services Here This section is for posting your free classified ads about new products and services, software, ebooks, and more.

Reply
 
Thread Tools Display Modes
Old 08-05-2011, 04:53 AM   #1
nishi838
 
Posts: n/a
Default Interactive chart form filtering code sample

Here is another repost from my blog... Enjoy--Clint

-----

One of the most enjoyable design challenges I have had over the last couple of years was redesigning how users can filter inside Access and Excel. The new filter dropdown menu and context menus were lots of fun to explore different designs and think creatively about how users interact with data. I wanted to make filtering simple for everyone to use but powerful enough to answer most hard questions. One of my key goals was to build a system where users could create 90% of WHERE clauses without using the query designer. It was really fun to watch users be successful use the features in the usability lab.

Recently, I have been hunting the web and rich applications looking for different ways to visualize and interact with data. I noticed in the 2007 Office Migration Planning Manager and the Microsoft Access 2003 Conversion Toolkit that a chart was used to filter tabular data. I thought it would be interesting to create a view that showed trends and data but yet was also useful. The Sales Pipeline template is an example of an application where trend-lines excite users. With a little code and a chart sub-form you can sprinkle a dab of visualization with a pinch of interactivity.

 

Clicking on a year, month label, or bar in the chart above will filter the Est Closed Date to the year or month selected. For example if you click on Jun you will see all sales opportunities in the month of June. Clicking on the 2007 label will show all the sales opportunities with an expected closed date in 2007. It is even smart enough to maintain filters on other columns as you filter. for example, if you filter where category = hot and click on the April month you will see all records where category = hot and in the month of April.

Here is an in progress version of the Sales Pipeline database.

Using the new split-form you can resize the height of the chart and datasheet with the chart growing or shrinking to fill the view.



Add the Chart

Step 1. Open the Open Opportunities List and select all the controls. Remove them from the stack so that you can size the form window smaller. Move all the controls in the detail section up into a cramp space. Turn on the split form resize bar by selecting the form setting the Split Form Splitter Bar = true.

 

Step 2. Create a new chart called Filter Chart Sub-form. I won;t go into the details of polishing the chart and the chart settings. Add the chart to the form covering all the controls in the detail section. I found it useful to select the sub-form and setting Top = 0. Select the sub-form and set the Anchoring property to stretch down and across.

 

Step 3. The next step is to make sure the chart is always updated when the user adds, updates, or deletes records. I added three simple embedded macros on the AfterUpdate, AfterInsert, AfterDelConfirm events to refresh the chart.

 

Make the Chart Interactive

Step 1. Add reference to c:\program files\Microsoft Office\Office12\ offowc.dll.

Step 2. Add the following code to the chart sub form. The code should be fairly straight forward. You use an API call to change the cursor from an arrow to a hand when the user hovers over the bars, month, or year labels.

When the user clicks on a bar or label it builds an approriate filter string. The first iteration of the demo removed all filters and applied just the new filter. So if the user had filtered by category and applied a filter to Expected Closed Date they would be viewing all categories again. I fixed this bug using the ClearFilterFromSelectedField runcommand to remove just the current column filter instead of the entire form filter. This is a new command in Access 2007.

You will need to modify the variables sFilterField and sFilterControl in the BuildSQL function to point to the field name and control name you want to filter in your own app. I haven't tried it but there shouldn't be any reason why this technique doesn't work in report browse as well. If anyone out there wants to modify the buildSQL routine to support filtering on strings--send me the updated sample and I will post it to the community following this blog.

Anyways, here is the code:

Option Explicit Private Const HandCursor = 32649&Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As LongPrivate Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long Dim WithEvents oChart As ChartSpace Private Sub Form_Load() Set oChart = Me.ChartSpaceEnd Sub Private Sub Form_Click() Dim sVal As String Dim sYear As String Dim iSeperator As Integer Select Case Me.ChartSpace.SelectionType Case chSelectionPoint sVal = Me.ChartSpace.Selection.GetValue(chDimCategories) iSeperator = InStr(1, sVal, "-") 'make sure we only filter for year or month and year If iSeperator = 0 Then 'selection is a year FilterByYear sVal ElseIf InStr(iSeperator + 1, sVal, "-") = 0 Then 'selection is a month and year sYear = Trim$(Mid$(sVal, 1, iSeperator - 1)) sVal = Trim$(Mid$(sVal, iSeperator + 1)) FilterByMonth sYear, sVal Else Exit Sub 'selection is a day or somthing of a lower level that we don't filter for End If Case chSelectionCategoryLabel 'set the source object to the proper form sVal = Me.ChartSpace.Selection.Caption Select Case Me.ChartSpace.Selection.Level 'check to see what level was selected on the x axis Case 0 'year FilterByYear sVal Case 1 'month sYear = Me.ChartSpace.Selection.ParentLabel.Caption FilterByMonth sYear, sVal Case Else Exit Sub 'selection is a day or somthing of a lower level that we don't filter for End Select End SelectEnd Sub 'filters the db list by monthPrivate Sub FilterByMonth(sYear As String, sVal As String) Me.Parent.Form.Filter = BuildSQL(Trim$(sYear), Trim$(sVal)) Me.Parent.Form.FilterOn = TrueEnd Sub 'filters the db list by yearPrivate Sub FilterByYear(sVal As String) Me.Parent.Form.Filter = BuildSQL(Trim$(sVal), "") If Me.Parent.Form.FilterOn = False Then Me.Parent.Form.FilterOn = TrueEnd Sub ' builds the SQL that will filter the formPrivate Function BuildSQL(sYear As String, sMonth As String) As String Dim sFilterField As String Dim sFilterControl As String sFilterField = "[Est Closed Date]" sFilterControl = "Est Closed Date" If sMonth <> "" Then 'passed in year and month BuildSQL = "(" & sFilterField & " >= #" & FormatDateTime(sMonth & " - " & sYear) & "#) AND (" & sFilterField & " <= #" & DateAdd("m", 1, FormatDateTime(sMonth & " - " & sYear)) - 1 & "#)" Else 'just passed in the year BuildSQL = "(" & sFilterField & " >= #1/1/" & sYear & "#) AND (" & sFilterField & " <= #12/31/" & sYear & "#)" End If 'Clear the filter from the field the chart is filtered on. 'If you want to clear the entire filter, just set Me.Parent.Filter = "". RemoveFilterFromField Me.Parent, sFilterControl ' If there is still something left of the filter If Me.Parent.Filter <> "" Then ' Append BuildSQL = BuildSQL & " AND (" & Me.Parent.Filter & ")" End IfEnd Function Private Sub RemoveFilterFromField(frm As Form, strControlName As String) frm.SetFocus frm.Controls(strControlName).SetFocus On Error Resume Next DoCmd.RunCommand acCmdRemoveFilterFromCurrentColumn ' This command is new to Access 2007. Debug.Assert Err.Number = 0 Or Err.Number = 2046 ' 2046 is thrown when there was no filter on the column Err.ClearEnd Sub Private Sub Form_CommandBeforeExecute(ByVal Command As Variant, ByVal Cancel As Object) ' Cancel the ability to drill into days and hours. If Command = chCommandDrill Then Cancel = True End IfEnd Sub Private Sub oChart_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long) Select Case TypeName(Me.ChartSpace.RangeFromPoint(x, y)) Case "ChCategoryLabel", "ChPoint" 'display hand cursor if pointer is over a label or bar SetCursor LoadCursor(0, HandCursor) Case Else 'display the normal cursor Screen.MousePointer = 0 End SelectEnd Sub <div
  Reply With Quote

Sponsored Links
Old 08-05-2011, 04:58 AM   #2
zq8j8ha3b5t
General of the Army
 
Join Date: Feb 2011
Posts: 1,591
zq8j8ha3b5t is on a distinguished road
Default

son to attend the National Day military parade, his father died in a car crash, righteous mother endure grief, 54 days to weave a lie, to hide the truth from his son, is to let his son successfully completed by the reading task. Yesterday, the newspaper Yesterday morning, Yuan Yaping holding the portrait of her husband in the TV to watch a military parade complete,prada handbags, completed her husband's dream alive.
This reporter saw Xinhuanet, People's Daily, CCTV network, China Network, and Sina, Sohu, Netease and more than 30 portal websites have prominently reproduced in this report. View friends of thousands of journalists message, but also gain a different kind of moving again. Many friends said he was In addition to moving,miu miu handbags, more netizens are expressing their true feelings blessing, Liaoning, NetEase users a message: , to conceal the truth, but also an ordinary mother and great righteous cause. a stick of incense burned before. 9 am, Wang Zhen's uncle, uncle,designer handbags, aunt and so came home. Parade began,tory burch handbags, Yuan Yaping hands tightly holding the portrait of her husband, her husband in this special way to 11:01, where the Navy's shore when the ship Zhen missile side team on a roll to pass through Tiananmen Square, when Yuan Yaping side of the screen, keep a close eye while saying: The side team drove up, he sat in the car.
Over the phone, the successful completion of the task by reading Zhen very excited, breathless first words he spoke, to, but I can feel you and Dad are watching TV to see me do. Son's words, has allowed Yuan Yaping know what to say, she does not know how to begin telling his son the truth,paul smith handbags, she had said to him, Yesterday morning, Wang Zhen, head of the unit through the network to see the newspaper has been reported, but in a closed state of Wang Zhen, still unaware of this. Yuan Yaping contact with military commanders, military leaders hope that the facts can tell Wang Zhen,paul smith bags, the face of this special Daily News correspondent Lee Chang Ling Faguo fundamental Ogawa
zq8j8ha3b5t is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:45 PM.

 

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum