• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

Blank Check Report

I have a report named VoucherBlanks created in Access 2003 that will create a one-page blank voucher check complete with check no, routing number, etc on the bottom of the check.  I also have a form I created called BlankMenu with fields, NumberChecks and StartingCheck.  I want to use this form to create a report that will generate x number of checks with starting check number y using the VoucherBlanks report.

Basically, given x number of blank checks and starting check number y, I want to create a report that's x pages long and each page has a check number of it that starts at y and increments up to y+x-1.

Page 1  Check No y
Page 2  Check No y+1
Page 3  Check No y+2
...
Page x  Check No y+x-1

Sorry for the confusing explanation, I think it's an easy concept just not too easy to explain.  Any help would be greatly appreciated.
0
jvolz
Asked:
jvolz
  • 4
  • 3
  • 2
1 Solution
 
hnasrCommented:
A sample database helps.
0
 
IrogSintaCommented:
The record source for your report called VoucherBlanks needs to point to a temp table.  Assuming your form has a button to print checks, you need to add code to its OnClick event like this:

    Dim i As Integer
    Dim strSQL As String
    
    If DCount("*", "MSysObjects", "Name='tblTempChecks'") > 0 Then DoCmd.DeleteObject acTable, "tblTempChecks"
    DoCmd.RunSQL "Create Table tblTempChecks (CheckNumber Text(10))"
        
    For i = Me.StartingCheck To Me.NumberChecks - 1
        strSQL = "Insert Into tblTempChecks (CheckNumber) Values ('" & i & "')"
        CurrentDb.Execute strSQL, dbFailOnError
    Next

    DoCmd.OpenReport "VoucherBlanks"

Open in new window

0
 
jvolzAuthor Commented:
I see where you're going with this, IrogSinta, but it still isn't working for me.  Basically the table, tblTempChecks was created, but nothing else is happening.  I understand better what I need, I want this table with field CheckNumber to create a record with the StartingCheck number and keep adding a new record, increment the Starting Check number by 1 until the CheckNumber reaches StartingCheck + NumberChecks -1 or NumberChecks times.  Once I can get that table and those records created, I can just set the recordsource to the tblTempChecks and print because the only value that will change in the blank checks is the check number.

In a nutshell this is what I'm trying to do,

For i= 1 to NumberChecks do

Create record tbleTempChecks.CheckNumber and  set value to i
i=i+1
Repeat loop

Thanks again.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
IrogSintaCommented:
Did the code I gave you not create the table with those numbers? If it did, did you change the record source to point to that temp table?
0
 
jvolzAuthor Commented:
I did change the record source on the report, the problem was that the table had no values in it.  Actually, I put a msgbox in the loop to see what would happen but it didn't seem to be getting into the loop because no messages showed up.
0
 
jvolzAuthor Commented:
I figured out where the problem was.  I tried a test with StartingCheck = 5, NumberChecks =5.

Your line:
For i = Me.StartingCheck To Me.NumberChecks - 1 --> for i = 5 to 4

I changed to

For i = Me.StartingCheck To (Me.StartingCheck + Me.NumberChecks - 1)

and everything works perfect!  Thanks for the assistance!!
0
 
hnasrCommented:
If you need to print  1 check per page,  sequenced from y, then :

It is straight forward. with no need for extra tables and unnecessary coding.

Instead of saying if you run the report from a form, then... and if ...

We ask for a skeleton database which answers the many ifs..
http:#38300744

Your database will show:
    the setup as if you are going to print one page manually.
    where the initial number and number of checks will be taken (a global variable, a textbox on a form, ...)
0
 
hnasrCommented:
You accepted a solution, but please keep in mind, there is a better solution if you supply information asked for. Understanding the problem is invaluable in giving a better solution.
0
 
jvolzAuthor Commented:
I did see your request for a sample database, but due to the fact that these are checks that we'll be printing, with routing/account numbers involved, I was reluctant to send a sample on the off-chance that I might forget to remove something and didn't want to recreate a new database to send.  I hope you can appreciate my concerns but I do appreciate your consideration of my post.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now