Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > Access
Back to Access Forum    Comments List
Convert Form To Report Upload Images   Link   Email  
Adam Schwanz             
6 months ago
Using this code will allow you to take one of your forms, and make an exact copy of it as a report. This is useful if you spend a lot of time making a form and want to keep the same format/layout inside of a report, you can do so with just one button click.

Instructions:
1. Make a new form

2. In the on load event of the form, enter the following code.
Dim frm As Object
Dim formNames() As String
Dim i As Integer
    
'Create Array
ReDim formNames(0 To CurrentProject.AllForms.Count - 1)
i = 0
For Each frm In CurrentProject.AllForms
    formNames(i) = frm.Name ' Store form name in the array
    i = i + 1 ' Increment counter
Next

' Assign the formNames array directly to the RowSource property of the combo box. Needs to be a Value List Combo box called FormNameCombo.
FormNameCombo.RowSource = ""
For i = LBound(formNames) To UBound(formNames)
    FormNameCombo.AddItem formNames(i)
Next i


3. Add a combo box to the form, make sure it's Row Source Type is Value List and call it FormNameCombo.

4. Add a button to the form and put this code in it.
On Error Resume Next
DoCmd.SelectObject acForm, FormNameCombo, True
RunCommand acCmdSaveAsReport


5. Save and open the form, select the form you want to copy inside the combo box and press the button. A popup will appear asking for the name for the report. Enter the name you want, press OK. The report is created.
Ludwig Willems       
6 months ago
Cool, I'll definitely try it out

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 10/11/2024 4:24:52 PM. PLT: 1s