472,791 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Limit Records Printed with Print Button on Subform.

Everyone on this group has been a great deal of help. I have another
question that I could use some help with. Once again, here is a picture of
my form:


I have a form with a shipment destination at the top. I then have a subform
that I enter boxes for that shipment. I have several shipments going at a
time, so I can use the control at the bottom of the form to move from
shipment to shipment and I can see all the boxes in each shipment. The form
and subform are linked by a field called Load_ID.

I would like to put a button called "Print Labels" on the subform so it
outputs the boxes from that shipment to a report which I have set up to
print labels. I set this button up, but it prints all the records in the
database instead of just that subform. I will be constantly adding
shipments with new Load_IDs, so I want a button that I can always press on
the subform to print the labels. What I am trying to say is that I don't
want to have to run a query for a specific Load_ID like "SD1". I want it
to be expandable and always print the subform I am on, no matter how many
subforms I have. Is this possible? If so, any suggestions would be

Thank You,

Nov 13 '05 #1
2 1852
I get help here also.

Put the following in your On Click event procedure on the command

DoCmd.OpenReport "YourReportNameHere", acViewPreview, ,
"[RelatedField]='" & Me.RelatedFieldAgain& "' "

Nov 13 '05 #2

Thanks for responding. I am a little confused about what you said, because
I'm very new to access. My form and subform are set up in the following way:

The main form is a table called Ship_Info, and the subform is a table called
Label_Info. They both contain and are linked by a field called Load_ID. My
report is actually a shipping label called "Label". I know where to put in
this code, but I wasn't sure how it was set up. It was also hard to tell
apostrpohes from quotation marks. Here is what I tried:

Me Refresh
DoCmd.OpenReport "Label", acViewPreview,,"[Load_ID]='"(note: apostrophe,
quote) & Me.Load_ID & '" " (note: apostrophe, quote, space, quote)
so without the notes:

Me Refresh
DoCmd.OpenReport "Label", acViewPreview,,"[Load_ID]='" & Me.Load_ID & '" "

I know the second part is not right-maybe none of it. I don't think I have
the Load_ID in the right place.

I want the button on the subform and to print only the records on the
subform. For example, N1 is the load ID for load #1 going to Nashville.
I'll change the Load_ID to something more meaningfull when I get this form

I would appreciate any help you could give me.


<dm******@hotmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
I get help here also.

Put the following in your On Click event procedure on the command

DoCmd.OpenReport "YourReportNameHere", acViewPreview, ,
"[RelatedField]='" & Me.RelatedFieldAgain& "' "

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: DD | last post by:
I have a mainform with a subform. > The main form has a dropdown box "chooseMonth", in the afterupdate event > i requery the subform so all records with the same date are viewed. > Now i only want...
by: Craig M | last post by:
Hi, I have a form, frmInvoices and a subform, frmInvoicesSub. On the parent form, i have a "print report" button, that prints a report depending on an ID on the parent form. Each record in...
by: Nancy | last post by:
I have two tables: TblCourse CourseID CourseName TblClass ClassID CourseID ClassDate
by: epascual | last post by:
Have a couple of question from a newbie. Thanks in advance. How do I print Report called from a Form (or SubForm) using the current record on the Form (or SubForm). How can I do a multiple Form...
by: Thelma Lubkin | last post by:
My form/subform combination that allows user to display 'ColorSet' records, move to other records via a selector, to add,delete, and edit them, and to manage the related 'Color' records from the...
by: orbitus | last post by:
I know that I am overcomplicating this. I have records that need to be printed. Lets say 536 records, some on two or more pages in the report. I want to print 30 records, then 30 more till the...
by: sparks | last post by:
I am trying to fix a database that someone did about 4 yrs ago in access97. The main table just contains demographics and is on the main form of the database. It has a subform on a tab that...
by: paquer | last post by:
On my Main form I have a Command Button that opens a Subform in order to create a new Subform record. At this point I want the subform to show only the new record being created. Not all the...
by: dfw1417 | last post by:
I have used a query and report filter to return records related to a specific account id. I want to print a report including only the latest 6 records out of the set returned by the record filter. I...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.