Connecting Tech Pros Worldwide Forums | Help | Site Map

Limit Records Printed with Print Button on Subform.

ChadDiesel
Guest
 
Posts: n/a
#1: Nov 13 '05
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



dmkeith2@hotmail.com
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Limit Records Printed with Print Button on Subform.


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& "' "

ChadDiesel
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Limit Records Printed with Print Button on Subform.


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
<dmkeith2@hotmail.com> wrote in message
news:1111881305.453433.201070@l41g2000cwc.googlegr oups.com...[color=blue]
>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& "' "
>[/color]


Closed Thread