Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-02-2012, 08:03 PM   #1
carrybag93
Newly Registered User
 
Join Date: May 2012
Posts: 73
Thanks: 21
Thanked 0 Times in 0 Posts
carrybag93 is on a distinguished road
Question Generate report from data just entered in a form

Hello,

I was wondering if there is a way to generate a report (maybe through use of a macro or something) from the data you just entered in a form.

So, there is an order form and the user fills out their details, saves the order, and then they can press a 'Generate Receipt' button, and a report pops up that is printable. Is this possible?

Thanks!

carrybag93 is offline   Reply With Quote
Old 06-02-2012, 08:25 PM   #2
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,126
Thanks: 13
Thanked 4,078 Times in 4,013 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Generate report from data just entered in a form

One way

http://www.baldyweb.com/wherecondition.htm
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
The Following User Says Thank You to pbaldy For This Useful Post:
carrybag93 (06-03-2012)
Old 06-03-2012, 03:45 AM   #3
carrybag93
Newly Registered User
 
Join Date: May 2012
Posts: 73
Thanks: 21
Thanked 0 Times in 0 Posts
carrybag93 is on a distinguished road
Re: Generate report from data just entered in a form

Could you please explain what it means?

carrybag93 is offline   Reply With Quote
Old 06-03-2012, 03:54 PM   #4
carrybag93
Newly Registered User
 
Join Date: May 2012
Posts: 73
Thanks: 21
Thanked 0 Times in 0 Posts
carrybag93 is on a distinguished road
Re: Generate report from data just entered in a form

I'm sure it makes sense, I just have no experience with Access (with exception for the last couple of weeks), so I am unfamiliar with the terms it uses and how to adapt the code for use in my own database, and where to put it. Does the code you linked me to generate a new report, or does it just add data to a previously made one? I need one generated for each sale, which can then be saved, printed and emailed by the user.
carrybag93 is offline   Reply With Quote
Old 06-03-2012, 04:25 PM   #5
Isskint
Slowly Developing
 
Isskint's Avatar
 
Join Date: Apr 2012
Location: Wiltshire, UK
Posts: 1,301
Thanks: 124
Thanked 311 Times in 304 Posts
Isskint will become famous soon enough
Re: Generate report from data just entered in a form

The way i would approach this is as follows:
  1. Set the forms Cycle property to Current Record (Properties>>Other)
  2. Place a control on the form to Print the report.
  3. Code the controls ONClick event as follows:
    1. Quote:
      DoCmd.RunCommand acCmdSaveRecord
      DoCmd.OpenReport "ReportName", acNormal, , "([OrderID])=" & Me.[OrderID]
__________________
Isskint, i get satisfaction out of helping others
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Success is the sum of small efforts, repeated day in and day out
Isskint is offline   Reply With Quote
The Following User Says Thank You to Isskint For This Useful Post:
carrybag93 (06-03-2012)
Old 06-03-2012, 07:01 PM   #6
carrybag93
Newly Registered User
 
Join Date: May 2012
Posts: 73
Thanks: 21
Thanked 0 Times in 0 Posts
carrybag93 is on a distinguished road
Re: Generate report from data just entered in a form

I made a print button and added the code like you said, but this error came up. What did I do wrong? I also changed the cycle to This Record. Was I supposed to change DoCmd to something else?
Attached Images
File Type: png error.png (88.8 KB, 107 views)
carrybag93 is offline   Reply With Quote
Old 06-03-2012, 07:09 PM   #7
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,126
Thanks: 13
Thanked 4,078 Times in 4,013 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Generate report from data just entered in a form

Sounds like you need this

http://www.baldyweb.com/FirstVBA.htm

__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
The Following User Says Thank You to pbaldy For This Useful Post:
carrybag93 (06-03-2012)
Old 06-03-2012, 07:42 PM   #8
carrybag93
Newly Registered User
 
Join Date: May 2012
Posts: 73
Thanks: 21
Thanked 0 Times in 0 Posts
carrybag93 is on a distinguished road
Re: Generate report from data just entered in a form

Thanks

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acNormal, , "([OrderID])=" & Me.[OrderID]

That's the code I put on the print button's event OnClick. Am I supposed to have a report already made for this to work, and replace "ReportName" with the name of the report? Because the whole point of this is to generate a NEW report, not open one that was already made. Am I supposed to change anything else in the code for it to work?

This is the last little part of my whole project, so I'm kind of keen on getting it done

Thanks for all your help (both of you) so far!
carrybag93 is offline   Reply With Quote
Old 06-03-2012, 08:51 PM   #9
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,126
Thanks: 13
Thanked 4,078 Times in 4,013 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Generate report from data just entered in a form

Yes, you're supposed to have a report built. Creating a new report on the fly would be highly unusual and no easy feat.
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 06-03-2012, 09:06 PM   #10
carrybag93
Newly Registered User
 
Join Date: May 2012
Posts: 73
Thanks: 21
Thanked 0 Times in 0 Posts
carrybag93 is on a distinguished road
Re: Generate report from data just entered in a form

And I put the name of the report in "ReportName"? Does the data in the report change when you press the button? Thanks for your help. I must be very frustrating!
carrybag93 is offline   Reply With Quote
Old 06-03-2012, 09:43 PM   #11
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,126
Thanks: 13
Thanked 4,078 Times in 4,013 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Generate report from data just entered in a form

You create a report that displays all records. The code will restrict it to the displayed record when it opens.
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 06-04-2012, 03:11 PM   #12
carrybag93
Newly Registered User
 
Join Date: May 2012
Posts: 73
Thanks: 21
Thanked 0 Times in 0 Posts
carrybag93 is on a distinguished road
Re: Generate report from data just entered in a form

So when a new record is added, what happens?
carrybag93 is offline   Reply With Quote
Old 06-04-2012, 03:14 PM   #13
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,126
Thanks: 13
Thanked 4,078 Times in 4,013 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Generate report from data just entered in a form

Is this a trick question? The table has one more record in it. If you mean with the report, it will show any record in the table.
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 06-04-2012, 03:18 PM   #14
carrybag93
Newly Registered User
 
Join Date: May 2012
Posts: 73
Thanks: 21
Thanked 0 Times in 0 Posts
carrybag93 is on a distinguished road
Re: Generate report from data just entered in a form

But I'll make the report with the records already created, and then when a new order is made in the order table, and they press the receipt button, a report will pop up with a whole heap of records that don't even include their order.
carrybag93 is offline   Reply With Quote
Old 06-04-2012, 03:22 PM   #15
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,126
Thanks: 13
Thanked 4,078 Times in 4,013 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Generate report from data just entered in a form

The wherecondition argument ("[OrderID]=" & Me.[OrderID]) restricts the report to the OrderID displayed on the form.

__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
The Following User Says Thank You to pbaldy For This Useful Post:
carrybag93 (06-04-2012)
Reply

Tags
access , button , form , generate , report

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
correct data and generate report ajitm Queries 1 06-04-2011 12:53 AM
Generate Report to PDF with filtered data bayman Reports 4 05-07-2011 10:00 AM
e-mail report based on data entered into form Funkbuqet Forms 9 05-05-2011 09:03 AM
Use form data to generate a report? laxster Reports 6 11-24-2009 03:42 PM
Creating a report from data entered in a form Wizzy Forms 8 12-09-2008 07:54 AM




All times are GMT -8. The time now is 09:11 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World