Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-24-2015, 02:42 AM   #1
daro
Newly Registered User
 
Join Date: Aug 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
daro is on a distinguished road
Printing a single record to a report

Hi everybody.

I'm completely new when it comes to Access and SQL databases, so I hope you can help me out a bit:

I have started a project at my workplace, where I'm making a database over equipment that is provided for our users.

Now I no problems with setting up the reports for my tables, but I also want to be able to print out a single record in a table.

I've looked into it and so far found three solutions:
  • Create a command button and insert the following code: DoCmd.OpenReport "YourReportName", acViewNormal, , "[YourFieldName] = '" & Me.FieldName & "'"
  • Set up a macro manually (as seen in the post from Trevor G in www(dot)access-programmers(dot)co(dot)uk/forums/showthread.php?t=195641)
  • Create a button and insert the code in the VBA editor (www(dot)allenbrowne(dot)com/casu-15.html)
In the first solution, I get an "invalid value for the WHERE condition" error, in both the number and text code (I'm using the unique ID or an owner field linked to an unique ID).

In the second it's probably because of language barriers, but I'm very unsure on what I'm supposed to do. (If Trevor happens to see this thread, I would appreciate it if he had the time to provide pictures of the process )

With the third, I get the report with all the fields I want shown, but the data that should be in that record isn't shown.

I hope you guys can help me find out exactly what and where I'm doing something wrong

P.S. Sorry about the links, but I can't post them yet

daro is offline   Reply With Quote
Old 08-24-2015, 03:33 AM   #2
Trevor G
Newly Registered User
 
Trevor G's Avatar
 
Join Date: Oct 2009
Location: Tamworth, Staffordshire
Posts: 2,331
Thanks: 4
Thanked 229 Times in 219 Posts
Trevor G will become famous soon enough Trevor G will become famous soon enough
Re: Printing a single record to a report

Welcome to the forum,

I am on line and noticed your thread. I have created a database that you can download to see the example. If you open the form and then select a record and use the button it will display a single record in the report. If this is what you want look at the macro in design view you will see the details you need.

Good luck
Attached Files
File Type: accdb PrintSingleRecord.accdb (716.0 KB, 398 views)
__________________
Trevor
I am on a learning curve of life, I know a little but like to share what I have learnt with others.
I am using Microsoft Office 2003 To 2016
Please remember everyone here is a volunteer, so if you have had a reply to your thread be courteous and acknowledge this.
Trevor G is offline   Reply With Quote
The Following 2 Users Say Thank You to Trevor G For This Useful Post:
AmalJS (07-30-2019), Lindak (01-25-2019)
Old 08-24-2015, 04:27 AM   #3
daro
Newly Registered User
 
Join Date: Aug 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
daro is on a distinguished road
Re: Printing a single record to a report

Thank you very much! I'll look into it

daro is offline   Reply With Quote
Old 08-24-2015, 10:56 PM   #4
daro
Newly Registered User
 
Join Date: Aug 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
daro is on a distinguished road
Re: Printing a single record to a report

Weird. I couldn't get it to work with my database
But I just started over and imported the data to a new one, and now it works like a charm.

Once again: Thank you so much!
daro is offline   Reply With Quote
Old 08-25-2015, 11:18 PM   #5
Trevor G
Newly Registered User
 
Trevor G's Avatar
 
Join Date: Oct 2009
Location: Tamworth, Staffordshire
Posts: 2,331
Thanks: 4
Thanked 229 Times in 219 Posts
Trevor G will become famous soon enough Trevor G will become famous soon enough
Re: Printing a single record to a report

Happy to help and thank you for letting me know you have a working solution.
__________________
Trevor
I am on a learning curve of life, I know a little but like to share what I have learnt with others.
I am using Microsoft Office 2003 To 2016
Please remember everyone here is a volunteer, so if you have had a reply to your thread be courteous and acknowledge this.
Trevor G is offline   Reply With Quote
Old 01-25-2019, 06:56 AM   #6
Lindak
Newly Registered User
 
Join Date: Jan 2019
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Lindak is on a distinguished road
Re: Printing a single record to a report

Thank you Trevor G for attaching PrintSingleRecord.accdb!!! I've been trying to figure out that for days. Was stuck on how to wrap a function around a variable in the where clause of the query builder, which wasn't working for me. This way was much easier. Now I just have to figure out how to get the report screen not to keep showing the same record unless I close the report each time I invoke it.
Lindak is offline   Reply With Quote
Old 07-30-2019, 04:07 AM   #7
AmalJS
Newly Registered User
 
Join Date: Jul 2019
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
AmalJS is on a distinguished road
Re: Printing a single record to a report

Quote:
Originally Posted by Trevor G View Post
Welcome to the forum,

I am on line and noticed your thread. I have created a database that you can download to see the example. If you open the form and then select a record and use the button it will display a single record in the report. If this is what you want look at the macro in design view you will see the details you need.

Good luck

Hi friend,

I tried this and after clicking the print button it is asking for "your query does not include the specified expression "First Name" as part of the aggregate function access."



AmalJS is offline   Reply With Quote
Reply

Tags
access , macros , reports , sql

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing a single Record from a Form in a Report Viper210 Reports 5 05-23-2012 10:06 AM
Question Printing a Single Record in a Report elio General 23 06-09-2011 12:10 PM
Printing a single record from a form in a report help jbeling Reports 7 12-05-2008 12:58 PM
Printing a single record from a form in report format lcboley General 1 10-01-2004 05:05 PM
printing a report for a single record microwize Forms 3 08-01-2002 08:29 AM




All times are GMT -8. The time now is 04:14 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