Labels

G

Guy Lydig

I have a report that generates labels for each name in a Therapist table. I
would like to have another report that first permits me to choose which names
I want by clicking a check box next to the names and also allows me to choose
the quantity of labels for each therapist.

Suggestions?

TIA

Guy
 
A

Allen Browne

Add 2 fields to your table:
- a Yes/no Field named (say) IsPicked for picking which clients to label;
- a Number field named (say) Quantity, for specifying how many labels you
want for each client.
(This assumes you may want different numbers of labels for each client.)

You can now click the IsPicked check boxe beside each client you want labels
for. To clear all the boxes again (after a print out, before the next one),
add a command button to your form, and put this code into the button's On
Click [event procedure]:
Private Sub cmdUnpickAll()
Dim strSql As String
If Me.Dirty Then Me.Dirty = False 'Save any edits
strSql = "UPDATE [YourTableNameHere] SET IsPicked = False " & _
"WHERE IsPicked <> False;"
dbEngine(0)(0).Execute strSql, dbFailOnError
End Sub

For details of how to get multiple labels per client, see:
Print a Quantity of a Label
at:
http://allenbrowne.com/ser-39.html
 
G

Guy Lydig

Thank you for your quick response. I am a novice so please bear with me. I
followed your very clear directions and now have a form that allows me to
check off a Yes/No field (for every therapist who needs a printed label) and
a Number Quantity field to type in the number of labels needed. I was even
able to modify the code so both fields are cleared when the command button is
clicked.

I need your help with the final step(s). How do I get the Labels report to
open the form and print the number of labels in the Quantity field only for
those with a check in the IsPicked field? Do I have to put code in the OnLoad
Event of the form, and if so, what code? Also, is it possible that closing
the report automatically clears the IsPicked and Quantity fields on the form?

Thanks so much for your time and patience. It is greatly appreciated.

Allen Browne said:
Add 2 fields to your table:
- a Yes/no Field named (say) IsPicked for picking which clients to label;
- a Number field named (say) Quantity, for specifying how many labels you
want for each client.
(This assumes you may want different numbers of labels for each client.)

You can now click the IsPicked check boxe beside each client you want labels
for. To clear all the boxes again (after a print out, before the next one),
add a command button to your form, and put this code into the button's On
Click [event procedure]:
Private Sub cmdUnpickAll()
Dim strSql As String
If Me.Dirty Then Me.Dirty = False 'Save any edits
strSql = "UPDATE [YourTableNameHere] SET IsPicked = False " & _
"WHERE IsPicked <> False;"
dbEngine(0)(0).Execute strSql, dbFailOnError
End Sub

For details of how to get multiple labels per client, see:
Print a Quantity of a Label
at:
http://allenbrowne.com/ser-39.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Guy Lydig said:
I have a report that generates labels for each name in a Therapist table. I
would like to have another report that first permits me to choose which
names
I want by clicking a check box next to the names and also allows me to
choose
the quantity of labels for each therapist.

Suggestions?

TIA

Guy
 
A

Allen Browne

To me, it makes sense to start with the form rather than the report. That
is, the user opens the form, selects the clients they want (by clicking the
IsPicked check box), and then clicks a command button on the form to open
the report. They don't open the report directly and then try to get from
there to the report. (My mindset probably comes from developing database
where the user never sees the Database window, but everything happens from
the form interface.)

If the button that opens the report is named cmdPreview, this is the kind of
thing that goes into its On Click [event procedure]:
Private Sub cmdPreview_Click()
If Me.Dirty Then Me.Dirty = False 'Save any edits
DoCmd.OpenReport "Report1", acViewPreview, , "(IsPicked)"
End Sub

Substitute your report name for Report1. Use acViewNormal if you want it to
print instead of preview. That should work, unless the form is already open
in the background.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Guy Lydig said:
Thank you for your quick response. I am a novice so please bear with me. I
followed your very clear directions and now have a form that allows me to
check off a Yes/No field (for every therapist who needs a printed label)
and
a Number Quantity field to type in the number of labels needed. I was even
able to modify the code so both fields are cleared when the command button
is
clicked.

I need your help with the final step(s). How do I get the Labels report to
open the form and print the number of labels in the Quantity field only
for
those with a check in the IsPicked field? Do I have to put code in the
OnLoad
Event of the form, and if so, what code? Also, is it possible that closing
the report automatically clears the IsPicked and Quantity fields on the
form?

Thanks so much for your time and patience. It is greatly appreciated.

Allen Browne said:
Add 2 fields to your table:
- a Yes/no Field named (say) IsPicked for picking which clients to label;
- a Number field named (say) Quantity, for specifying how many labels you
want for each client.
(This assumes you may want different numbers of labels for each client.)

You can now click the IsPicked check boxe beside each client you want
labels
for. To clear all the boxes again (after a print out, before the next
one),
add a command button to your form, and put this code into the button's On
Click [event procedure]:
Private Sub cmdUnpickAll()
Dim strSql As String
If Me.Dirty Then Me.Dirty = False 'Save any edits
strSql = "UPDATE [YourTableNameHere] SET IsPicked = False " & _
"WHERE IsPicked <> False;"
dbEngine(0)(0).Execute strSql, dbFailOnError
End Sub

For details of how to get multiple labels per client, see:
Print a Quantity of a Label
at:
http://allenbrowne.com/ser-39.html

Guy Lydig said:
I have a report that generates labels for each name in a Therapist
table. I
would like to have another report that first permits me to choose which
names
I want by clicking a check box next to the names and also allows me to
choose
the quantity of labels for each therapist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top