07-03-07, 19:27 #1Moderator
- Join Date
- Dec 2004
- Madison, WI
I have a grid with cells 1 through 150 (15 columns by 10 rows) . I want to detect if the cells are diagonally BUT I don't want to go off the edge of the grid to do it. For example, cell 115 is diagonal to 83 (on the grid) and cell 106 is diagonal to 74 (but I want it to return false for 106 to 74 because you have to go off the edge of the grid.
Here's what I'm using...
If Int((OrgPieceIndex - Index) / 16) = ((OrgPieceIndex - Index) / 16) Then
If Int((OrgPieceIndex - Index) / 14) = ((OrgPieceIndex - Index) / 14) Then
(Teddy - I have to ask this again as I'm having problems with the equation.)
Last edited by pkstormy; 07-03-07 at 21:53.Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
07-06-07, 13:48 #2Purveyor of Discontent
Provided Answers: 1
- Join Date
- Mar 2003
- The Bottom of The Barrel
Hmmmm, I overlooked that possiblity...
You should be starting with this, which tells you that the two values are on vertically adjacent rows and the offset one column from each other:
If ABS(Ceiling(OrgPieceIndex / 15) - Ceiling(Index / 15)) = 1 and ABS(OrgPeiceIndex % 15 - Index % 15) = 1
If Not (OrgPieceIndex mod 15 + Index mod 15) = 1 Then...oh yeah... documentation... I have heard of that.
*** What Do You Want In The MS Access Forum? ***