My Assistant
![]() ![]() |
|
|
Jul 22 2008, 04:23 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 69 |
Hello All,
Well, I have one of those challenges that definitely can be done, but I can't seem to find the answer. I am working on a Check Register Report which lists our Checks in Check Number Order. I would like to identify if any Check Numbers are MISSING. (This is pretty similar to a standard Bank Statement that we all receive) Example: Check#... Amt 1300 ... 125.00 1301 ... 234.00 1302 ... 127.00 1304 ... 537.00 In the above sequence, Check Number 1303 is MISSING. Is there a way to highlight/identify the gap where 1303 SHOULD be - OR - Highlight 1304 to identify that a preceeding number was missed? Is there a way to calculate a field in a report and compare it to the prior row? Any other ideas? Thanks for any possible insights, David |
|
|
|
Jul 22 2008, 07:02 PM
Post
#2
|
|
|
Retired Moderator Posts: 19,667 |
You can base your Report on a Query with SQL something like (***untest***):
CODE SELECT Current.*, IIf(Previous.CheckNo Is Null, "Gap", "No Gap") As GapIndicator FROM [tblCheck] AS Current LEFT JOIN [tblCheck] AS Previous ON Current.CheckNo = Previous.CheckNo + 1 I guess it can be done purely in the Report also but this will need some VBA code and probably slightly more complex. Hence my preferred method is to do the processing in the RecordSource Query. |
|
|
|
Jul 23 2008, 01:11 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 69 |
Thanks. I'll give it a try.
I appreciate the help. David |
|
|
|
Jul 23 2008, 06:17 PM
Post
#4
|
|
|
Retired Moderator Posts: 19,667 |
You're welcome... Hope it work the way you want...
|
|
|
|
Jul 30 2008, 06:56 AM
Post
#5
|
|
|
UtterAccess Enthusiast Posts: 69 |
Thanks again. I finally was able to try, and it did work.
I find I tend to focus first on VBA and I seem to forget the power of SQL. Thanks for the reminder. David |
|
|
|
Jul 30 2008, 07:14 AM
Post
#6
|
|
|
Retired Moderator Posts: 19,667 |
You're welcome... Glad you worked it out...
|
|
|
|
Jul 30 2008, 10:53 AM
Post
#7
|
|
|
New Member Posts: 3 |
Van
I used this code as well. Thanks! However, I am having a problem with leading zeros. This code is giving me the message "Gap" when there is no gap. I believe it's due to the leading zero. Can you help? Bobbi |
|
|
|
Jul 30 2008, 05:15 PM
Post
#8
|
|
|
Retired Moderator Posts: 19,667 |
AFAIK, the format shouldn't matter provided that your Field values are actually numeric, i.e. your Field data type is AutoNumber, Long, Integer, etc...
Check the data type in the design view of the Table ... If it is Text, the SQL may not work ... |
|
|
|
Jul 31 2008, 08:17 AM
Post
#9
|
|
|
New Member Posts: 3 |
It is a text field. My document number also has alph characters. I used a formula to remove the alpha before using the SQL. I also tried val to convert to a number and that didn't seem to work either. When there is an actual gap #Error is returned.
|
|
|
|
Jul 31 2008, 06:00 PM
Post
#10
|
|
|
Retired Moderator Posts: 19,667 |
Please post a copy of your database with your attempted Query / SQL...
Please compact and zip the database before posting... |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 06:52 AM |