Results 1 to 6 of 6
  1. #1
    sharonir22 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    May 2015
    Posts
    16

    Too complicated

    Hi
    I have a table containing ID numbers and location data (xxxxxx/yyyyyy)
    I have a search form in which you can insert a location (in the format above) and a distance and a query returns all the records that are in stated distance or less.

    Problem is my query criteria is too complex.

    I created a function that gets the 2 locations and calculates the distance between them.

    So i set the location criteria to be:

    Distance([table].[location],[Forms]![searchform]![location])<[Forms]![searchform]![distance]

    But Access wouldn't let me run the query saying the criteria is too complex and suggesting I use parameters.

    I would rather not use parameters. Is there an easy solution I'm missing here?

    Tnx a lot in advance

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Location data looks like a string. x and y really should be in separate fields. What data type is distance?

    Location field is referencing itself as part of criteria. That may be cause of 'too complex'. Don't really understand the function. Post code.

    Post the query SQL statement.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    sharonir22,

    Put yourself in the position of the reader. We do not know you, your environment, nor exactly what you are trying to do. Perhaps you could describe or provide an example complete with input and desired output.

    Is there an easy solution I'm missing here?
    Possibly, but readers have no idea what you are trying to do.

    Try again to describe WHAT you want to accomplish in plain English -- no database, no code, no jargon...

    For background info you could research Great Circle calculations

  4. #4
    sharonir22 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    May 2015
    Posts
    16
    Quote Originally Posted by orange View Post
    sharonir22,

    Put yourself in the position of the reader. We do not know you, your environment, nor exactly what you are trying to do. Perhaps you could describe or provide an example complete with input and desired output.


    Possibly, but readers have no idea what you are trying to do.

    Try again to describe WHAT you want to accomplish in plain English -- no database, no code, no jargon...

    For background info you could research Great Circle calculations
    I need a list of people that live in a certain radius of my location.

    My table- field of ID (num), field of location (string)

    Distance- recives 2 locations and calculates the distance between them
    (The function works perfectly. )

    I want to enter my location data in a form and the distance I need and run the query.

    My problem is with the criteria.


    Btw June7 I have tried seperating the location but I prefer leaving it as a string. The function separates it for the calculation.

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Please post your function code.
    The function works perfectly.
    ???
    How do you identify locations? Lat/Long?
    Did you see the function(s) in the link I posted?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Did not provide requested info.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums