By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,315 Members | 2,150 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,315 IT Pros & Developers. It's quick & easy.

Limit Records Printed with Print Button on Subform.

P: n/a
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:

http://www.chadworld.com/images/form.jpg

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
appreciated.

Thank You,

Chad
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I get help here also.

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

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

Nov 13 '05 #2

P: n/a
Hello,

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
going.

I would appreciate any help you could give me.

Thanks,

Chad
<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
button.

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

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.