[AccessD] Math Problem

A.D.Tejpal adtp at touchtelindia.net
Wed Oct 29 10:52:47 CST 2003


Lonnie,

    You may like to have a look at the sample database file named MatchCombinations_2K.zip just prepared by me. 

    It is available at Rogers Access Library (Other Developer's Section) and can be accessed at the following link -
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Tejpal,A.D.

    The db is in Access 2000 file format, developed on Access XP installation. Some of the salient features are outlined in the note given below.

Regards,
A.D.Tejpal
--------------
Description (MatchCombinations_2K.zip) -
    This is an exercise in matching largest possible combinations of positive and negative values for a given field in the database so that their overall values offset each other. This information is relevant to certain systems of book keeping. 
    In order to achieve best results, at the same time avoiding unaffordable slowing down in processing each and every possible combination (the number of theoretically possible combinations could assume astronomical proportions as the total number of records in the database increases), following sort sequence is adopted for positive and negative values before computing their running sums, each subset of which is in turn subjected to cartesian comparison -
    (a) Pos Asc,         Neg Asc
    (b) Pos Asc,         Neg Desc
    (c) Pos Desc,       Neg Asc
    (d) Pos Desc,       Neg Desc
    (e) Pos Random, Neg Random

    Finally, the best result out of the above can be displayed on clicking the appropriate command button.
---------------------------------------------------
  ----- Original Message ----- 
  From: William Hindman 
  To: Access Developers discussion and problem solving 
  Sent: Wednesday, October 15, 2003 23:02
  Subject: Re: [AccessD] Math Problem


  ...one record against another ...but afaik, not multiple combinations of 2,
  3, 4, 5, etc

  William Hindman
  "The future will not belong to those who are cynical or
  those who stand on the sidelines. The future will belong to those who
  have passion and are willing to work hard to make our country better."
  ...Paul Wellstone "The Conscience of a Liberal"

  ----- Original Message ----- 
  From: "Drew Wutka" <DWUTKA at marlow.com>
  To: "'Access Developers discussion and problem solving'"
  <accessd at databaseadvisors.com>
  Sent: Wednesday, October 15, 2003 12:16 PM
  Subject: RE: [AccessD] Math Problem

  > JET runs every possible combination when you don't give it something to
  JOIN
  > with.  That forces the all combination loop.
  >
  > Drew
  >
  > -----Original Message-----
  > From: William Hindman [mailto:wdhindman at bellsouth.net]
  > Sent: Tuesday, October 14, 2003 6:08 PM
  > To: Access Developers discussion and problem solving
  > Subject: Re: [AccessD] Math Problem>
  >
  > ...I can see something like that working for a two record compare but you
  > lose me when you start looking at several records that could together sum
  to
  > zero?
  >
  > William Hindman
  > "The future will not belong to those who are cynical or
  > those who stand on the sidelines. The future will belong to those who
  > have passion and are willing to work hard to make our country better."
  > ...Paul Wellstone "The Conscience of a Liberal">
  >
  > ----- Original Message ----- 
  > From: "Drew Wutka" <DWUTKA at marlow.com>
  > To: "'Access Developers discussion and problem solving'"
  > <accessd at databaseadvisors.com>
  > Sent: Tuesday, October 14, 2003 6:50 PM
  > Subject: RE: [AccessD] Math Problem>
  >
  > > What I was going to suggest, was to create an SQL string with a Join
  > between
  > > the same table over and over (for each number of records), then let JET
  > > create the combinations for you.  The last field would be a sum of the
  > other
  > > fields, so you would just need to add a criteria where the sum equals 0.
  > >
  > > Drew
  > >
  > > -----Original Message-----
  > > From: Mitsules, Mark [mailto:Mark.Mitsules at ngc.com]
  > > Sent: Tuesday, October 14, 2003 5:21 PM
  > > To: 'Access Developers discussion and problem solving'
  > > Subject: RE: [AccessD] Math Problem> >
  > >
  > > I am waiting in anticipation for even a suggestion of how one would accomplish this.  I am not a math or coding genius by any stretch, but a little refresher research on combinations confirmed that coding a solution would be over my head.  The first stumbling block is allowing for any
  > > possible combination of records up to and including the max number of
  > > records in the recordset.  The second is tracking each "hit" without
  > > repeating that combination later on in a different order.  I'm usually a
  > > "glass is half full" kind of guy...but "yikes".> >
  > >
  > > Mark
  > >
  > >
  > > -----Original Message-----
  > > From: Lonnie Johnson [mailto:prodevmg at yahoo.com]
  > > Sent: Tuesday, October 14, 2003 1:31 PM
  > > To: 'MS-ACCESS-L at lists.missouri.edu'; AccessDevelopers; AccessD solving'
  > > Subject: [AccessD] Math Problem
  > >
  > >
  > > This is one for the math guys who code. I have a situation where I need to take a field in a group of records and see if any combination of the values in the field equal zero.
  > >
  > > Example:
  > >
  > > MyField
  > >    5
  > >   -2
  > >    7
  > >   -3
  > >    6
  > >
  > > This group of records would have a combination that equals zero
  > (5, -2, -3).
  > > I hope someone has something.> >
  > >
  > >
  > > Lonnie Johnson
  > > ProDev, Professional Development of MS Access Databases
  > > Visit me at ==> http://www.prodev.us



More information about the AccessD mailing list