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

Click on Map area to chose filter for Query

Hi all, i am a newbie trying to have a map of South Africa with the
various Provinces (States) and want to click on one and them to open a
report for that selection, using the clicked area as the filter criteria
for the query, or must one make a query for each province ??

Thanks in advance for any help

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
Nov 30 '05 #1
4 1723
On Wed, 30 Nov 2005 10:03:11 GMT, Les Stout <an*******@devdex.com>
wrote:

You'll want to use what the help file and all the books call a
"parameter query".
To find out what province was clicked, perhaps each can have a
different color. There are ways to get the color of the pixel that was
clicked, e.g. there is a Windows API that can do this (sorry I forgot
the name).

-Tom.

Hi all, i am a newbie trying to have a map of South Africa with the
various Provinces (States) and want to click on one and them to open a
report for that selection, using the clicked area as the filter criteria
for the query, or must one make a query for each province ??

Thanks in advance for any help

Les Stout

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


Nov 30 '05 #2

"Tom van Stiphout" <no*************@cox.net> schreef in bericht news:26********************************@4ax.com...
On Wed, 30 Nov 2005 10:03:11 GMT, Les Stout <an*******@devdex.com>
wrote: To find out what province was clicked, perhaps each can have a
different color. There are ways to get the color of the pixel that was
clicked, e.g. there is a Windows API that can do this (sorry I forgot
the name).


Another approach (no API's needed) would be to use invisible controls at the image of the map.
I have seen a similar case implemented that way once.

For some country's you will need several controls to 'get it covered'.
When a naming-convention is used for the controls, you are able to call a generic function to do what you want when a control is clicked.
(use Screen.ActiveControl.Name in the function)

Maybe the country's have ID's like 1, 2 , 3 ,4 x x x x x
Name your controls like 1Ctrl1, 1Ctrl2, 1Ctrl3 these are the controls behind (before) Country1
(3 controls needed to cover the country1)
Name your controls like 2Ctrl1, 2Ctrl2, these are the controls behind (before) Country2
(2 controls needed to cover the country2)

You get the idea I hope?

Arno R

Nov 30 '05 #3
Tom van Stiphout wrote:
On Wed, 30 Nov 2005 10:03:11 GMT, Les Stout <an*******@devdex.com>
wrote:

You'll want to use what the help file and all the books call a
"parameter query".
To find out what province was clicked, perhaps each can have a
different color. There are ways to get the color of the pixel that was
clicked, e.g. there is a Windows API that can do this (sorry I forgot
the name).

-Tom.


I like Tom's idea. If you can find the API function to return the
pixel information it would be a very elegant solution to the problem.
Maybe:

Private Declare Function GetPixel Lib "gdi32.dll" (ByVal hdc As Long,
ByVal x As Long, ByVal y As Long) As Long

It is rumored that a call to GetDeviceCaps can determine whether or not
GetPixel can be used on a particular device.

If not, I have not yet proven the following but it's the best my
intuition can do at the moment. Also, I believe that some graphics
books show some standard methods for determining whether or not a point
is in a region bounded by line segments. Note that HTML has this
capability built-in :-).

Assuming the region is a simple polygon (possibly concave in places),
make a table that consists of the point coordinates of the polygon in
order, say counterclockwise (CCW). It should look something like:

tblBoundaries
BID Autonumber Primary Key
ProvinceID Long Foreign Key
VertexID Long
VX Long (Twips)
VY Long (Twips)

I am assuming you are getting X and Y from the MouseDown event (perhaps
Detail_MouseDown). X is positive to the right and Y is positive down.
Let the envelope region of a line segment be defined as the region
swept out by the line segment along its normal in both directions. If
the point that was clicked does not lie in any of the envelopes of its
boundary then it must lie outside the region. Of the boundary segments
whose envelope contains the point find the closest one. Decide what
you want to do if a point on the vertex or boundary is chosen. If CCW
was chosen, the point is interior if it lies to the left when going
from the smaller numbered vertex to the larger (except for N back to
1). I believe the distance (or its square for simplicity) from a point
to a line as well as an envelope test done by seeing if the point lies
within two lines can be improved using vector math (directed line
segments correspond 1-1 with vectors). Until a region is found, the
code would need to loop through each ProvinceID. I'm guessing that a
public function utilizing recordsets will be needed to implement
obtaining the ProvinceID, if any, of the location clicked. When you
can obtain the ProvinceID you can use a single report that covers any
province. As you can see, this method involves a lot more work than
using Tom's idea even if you cut some corners (literally :-)). Post
back if you'd like me to explore this idea further.

James A. Fortune

Dec 1 '05 #4
Thank you all for the input, will bash on with it. Sorry for the time
delay due different time zones..

best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
Dec 1 '05 #5

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

Similar topics

2
by: Andante.in.Blue | last post by:
Hi everyone! I was wondering if there is a away to use Access 97's build in filter-by-form function but restrict its effect to just the subform. I have a parent form that shows the major...
4
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
1
by: DS | last post by:
Anyone know of a Bug in Access for Office XP 2002? When you have a Macro from the On Click event to open a Second form with a where property it doesn't work. It'll open the form but won't find...
3
by: cover | last post by:
Is it possible to use a 'mouse up' click in forms where if you have for example, a drop down menu where you might click as the top selection, an equipment area (hard coded into the form), the type...
1
by: lorirobn | last post by:
Hi, I have a report that works just fine. Now I would like to add the capability to choose selection criteria to limit what is displayed. I created several reports that do this, but they used...
2
by: tjdoss | last post by:
I am trying to display the "Filter by Form" criteria in a Report (that displays the filtered information). I have an unbound textbox with !. as the control source that will give me the Filter itself...
3
by: amir | last post by:
How can I filter again my previous filtered records, I mean when I filter an entire I can filter again and again the filtered data. Many thanks for your help. Amir
3
by: chris | last post by:
I have a form det-up as a continous form. In the Header of the form I have a command button called "Approve". What I'm looking to do is when the user clicks the command button all of the records...
9
by: dee | last post by:
I'd like to filter by the following criteria: left(LeadDisposition,3) = "Sit" AND Appt_Date = Text767 I have no idea how to do this. Appreciate help.
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.