Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

number of pages 1

Status
Not open for further replies.

picolit

Technical User
Sep 2, 2005
1
IT
Hello
I am not expert to use access, I need to create a report not based on table or query to print several white pages, in this pages I will show only the number of the page.
The starting number of page will be find in a text box in a form also the last number of page will be find in the same form.
Consequently if in the form I type first number of page 5000 last number of page 5100, I want print 100 pages numbered 5000,5001,5002, etc.
Excuse me for my english because I'm Italian.
Your help will be appreciated.
Thanks in advance.
 
Hi.
I made a table called "ReportPageNumbers" with one field "PageNumber" (Number = Long Integer). This table will be filled with page numbers based on what you put into a form.

Form = "Main", two text boxes called txtPageFrom and txtPageTo.

Report called "BlankPages", with recordsource of table "ReportPageNumbers"; put field "PageNumber" into the Detail section.

Put a button on your form, and in it's OnClick event paste this code:

Code:
    'Clear table ReportPageNumbers
    CurrentDb.Execute "Delete * from ReportPageNumbers"
    
    'Fill ReportPageNumbers with numbers
    Dim rs As DAO.Recordset
    Dim i As Integer
    
    Set rs = CurrentDb.OpenRecordset("Select * from ReportPageNumbers")
    
    For i = Forms!Main!txtPageFrom To Forms!Main!txtPageTo
        rs.AddNew
        rs!PageNumber = i
        rs.Update
    Next i
    
    DoCmd.OpenReport "BlankPages", acViewPreview
    
    Set rs = Nothing

In a code window, go menu item TOOLS+REFERENCES and make sure you have Microsoft DAO 3.6 (or whatever the highest available version is) checked.

So you fill in your page numbers and hit the button, and the report will open in preview mode with the page numbers in it.

Try it out and let us know how it goes.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
HelloGingerR
thanks a lot it works very fine.
With your help I've solved my problems.
Regards

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top