473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Create a receipt as a report for one entry

emandel
65
Hello
Using MS Access 2003.

So I have a form where I enter donations which are attached to donors.

I would like to hit a button on that form that will generate a report which would essentially be a receipt for that donation.

I need help with the following.
1) how do I make the report applicable for only that one entry.
2) How do I attach the button that will take me to that report.

Please give me the instructions in non-programmer language.

Thank you,

eli
Apr 7 '13 #1
5 3541
Seth Schrock
2,965 Expert 2GB
You would just need to set the WHERE clause when you open the report. For example
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "your report name",,,"ID = " & ID_Field
You would need to replace ID with the name of the field that is the primary key field (the field that uniquely identifies that record) and replace ID_Field with the name of the control has holds the primary key value. Just out this code in your Burton's OnClick event.
Apr 7 '13 #2
emandel
65
DoCmd.OpenReport "your report name",,,"ID = " & ID_Field

my report is called "Donations"

The primary key is indeed called id in the table "donations"

would it then me rewritten as follows?
DoCmd.OpenReport "donations",,,"ID = " & ID
Apr 7 '13 #3
Seth Schrock
2,965 Expert 2GB
I would say that it is worth a try. The only question that I have about it is the name of the control on your form whose data source is "ID". There is a really good chance that its name is ID, but not being sure, I'm not sure it will work. Make sure that at the top of your code page, you have OPTION EXPLICIT set and then click Debug>Compile your database name. That should catch a few errors if there are any.
Apr 7 '13 #4
emandel
65
Ok correction, the control on the form is donations_id.

I am not getting the results I want, it is giving me a syntax error. Perhaps the report isn't right. Right now the report gives me all of the records. How do I limit the report to give me just one record, and then how do I get it to open that report to the record I want from the button.
Apr 9 '13 #5
Seth Schrock
2,965 Expert 2GB
One more question that I forgot to ask. What is the data type of the field ID? If it is a number field, then the syntax would be
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport ReportName:="Donations", WhereCondition:="ID = " & Me.Donations_ID
If it is a text type, then the syntax is
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport ReportName:="Donations", WhereCondition:="ID = '" & Me.Donations_ID & "'"
You just need to put the code in your button's OnClick event.
Apr 9 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jorge Cecílio | last post by:
Hi all! How can I create a report from a Java application? I've been developing a (small) JDBC app that retrieves invoice data giving its number. (I'm using a Swing GUI) The app works fine...
3
by: Jaycee66 | last post by:
I am new to MS Access 2000 and I am trying to create a report that would produce the last seven/any number days of data input through a form? In addition, recommendations of any good Access...
1
by: laddie1997 | last post by:
When I try to create a report in Access 2003, the error message "the wizard is unable to create your report" comes up. My printer is a network printer and no local printer is attached. I can get...
1
by: philou | last post by:
HI, I would like to know if it is possible to create automatically a new entry i´n a table who is in relation one to one to another one. I would like that a new entry be created in table B when...
1
by: Saqi | last post by:
Hi Guys, I am using Microsoft Access 2002 SP1 and when I try to create report using Microsoft Access 2002 SP1 I get the follwing error: The Wizard is unable to create your report. The...
4
by: Gari | last post by:
Hello, I have turned around this problem but because of my little knowledge of Access, I did not find any solution. So I am posting once again my request in the forum (that really helped me so...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
8
dnb
by: dnb | last post by:
Hi.... How to create crystal report in vb6.0? What is the first step of creating a crystal report? How to add crystal report in vb6.0? Please tell from which step to start creating crystal...
1
by: alhomam | last post by:
hi all i have a table with many columns and i need to create a report that the user can select the columns he needs to show in the report. is it possible? thanks
8
by: klbrownie | last post by:
I am trying to create a report that asks the user to select the report option from a drop down field. The field is based on field in a form, which pulls its options from a table. Source Table -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.