Print label after Form selection

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I have a Form that is based on a query that shows
customer information, plus it has a check box that can be
selected. I am needing a way where I can automatically
print a label when this check box is selected from the
Form. Thanks in advance.
 
Jim,
Make a Label report.

Make sure the check box is bound to the record.
Then code a Command Button Click event:

DoCmd.OpenReport "LabelReportName", acViewPreview, , "[CheckBoxName] = -1"

Place a check mark in each record for which you wish to have a label
printed.
Press the command button.

To then clear the existing check mark after printing, add another command
button.
Name it "Clear Check Marks"

Code it's Click Event:
CurrentDb.Execute "Update TableName Set TableName.[CheckBoxName] = 0;",
dbFailOnError

Change all the report, table and field names above to whatever the actual
names are.
 
Fred, I appreciate the help on this. Your code worked
great. What this does though, is print all the records
that have a check mark. I was looking at something that
will leave the checkmark in place but just print that one
record at the time it is being selected. I am trying to
send the selected customer name and address to a label
printer, instead of using a sheet of labels.
-----Original Message-----
Jim,
Make a Label report.

Make sure the check box is bound to the record.
Then code a Command Button Click event:

DoCmd.OpenReport "LabelReportName",
acViewPreview, , "[CheckBoxName] = -1"
Place a check mark in each record for which you wish to have a label
printed.
Press the command button.

To then clear the existing check mark after printing, add another command
button.
Name it "Clear Check Marks"

Code it's Click Event:
CurrentDb.Execute "Update TableName Set TableName. [CheckBoxName] = 0;",
dbFailOnError

Change all the report, table and field names above to whatever the actual
names are.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
I have a Form that is based on a query that shows
customer information, plus it has a check box that can be
selected. I am needing a way where I can automatically
print a label when this check box is selected from the
Form. Thanks in advance.


.
 
I am needing a way where I can automatically
I guess I mis-understood your question.
To print out just the current record shown on the form,
just code the command button:

DoCmd.OpenReport "Report Name", acViewPreview, , "[RecordID] = " &
[RecordID]

where [RecordID] is the unique prime key field, and is a Number datatype.

If [RecordID] is a Text datatype, then use:
[RecordID] = '" & [RecordID] & "'"

The check box does not need to be checked.
Change [RecordID] to the actual name of the record's prime key field.
Change acViewPreview to acViewNormal to print without previewing.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
Fred, I appreciate the help on this. Your code worked
great. What this does though, is print all the records
that have a check mark. I was looking at something that
will leave the checkmark in place but just print that one
record at the time it is being selected. I am trying to
send the selected customer name and address to a label
printer, instead of using a sheet of labels.
-----Original Message-----
Jim,
Make a Label report.

Make sure the check box is bound to the record.
Then code a Command Button Click event:

DoCmd.OpenReport "LabelReportName",
acViewPreview, , "[CheckBoxName] = -1"
Place a check mark in each record for which you wish to have a label
printed.
Press the command button.

To then clear the existing check mark after printing, add another command
button.
Name it "Clear Check Marks"

Code it's Click Event:
CurrentDb.Execute "Update TableName Set TableName. [CheckBoxName] = 0;",
dbFailOnError

Change all the report, table and field names above to whatever the actual
names are.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
I have a Form that is based on a query that shows
customer information, plus it has a check box that can be
selected. I am needing a way where I can automatically
print a label when this check box is selected from the
Form. Thanks in advance.


.
 
Fred, now I am getting an error that states Access can't
find the field 'Memnum' referred to in the expression.
Following is the code: DoCmd.OpenReport "Labels
Membership", acViewPreview, , "[Memnum] = " & [Memnum]
Memnum is the primary key field in the database and it is
numeric. What am I doing wrong?
-----Original Message-----

I guess I mis-understood your question.
To print out just the current record shown on the form,
just code the command button:

DoCmd.OpenReport "Report Name",
acViewPreview, , "[RecordID] = " &
[RecordID]

where [RecordID] is the unique prime key field, and is a Number datatype.

If [RecordID] is a Text datatype, then use:
[RecordID] = '" & [RecordID] & "'"

The check box does not need to be checked.
Change [RecordID] to the actual name of the record's prime key field.
Change acViewPreview to acViewNormal to print without previewing.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
Fred, I appreciate the help on this. Your code worked
great. What this does though, is print all the records
that have a check mark. I was looking at something that
will leave the checkmark in place but just print that one
record at the time it is being selected. I am trying to
send the selected customer name and address to a label
printer, instead of using a sheet of labels.
-----Original Message-----
Jim,
Make a Label report.

Make sure the check box is bound to the record.
Then code a Command Button Click event:

DoCmd.OpenReport "LabelReportName",
acViewPreview, , "[CheckBoxName] = -1"
Place a check mark in each record for which you wish
to
have a label
printed.
Press the command button.

To then clear the existing check mark after printing, add another command
button.
Name it "Clear Check Marks"

Code it's Click Event:
CurrentDb.Execute "Update TableName Set TableName. [CheckBoxName] = 0;",
dbFailOnError

Change all the report, table and field names above to whatever the actual
names are.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


I have a Form that is based on a query that shows
customer information, plus it has a check box that
can
be
selected. I am needing a way where I can automatically
print a label when this check box is selected from the
Form. Thanks in advance.


.


.
 
Is MemNum included in the Form, as well as in the Report?
Are you absolutely sure it is spelled properly?
"MemNum" is not the same as "Men Num" or "Mem_Num"

The code you are using is correct if MemNum is a Number datatype.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
Fred, now I am getting an error that states Access can't
find the field 'Memnum' referred to in the expression.
Following is the code: DoCmd.OpenReport "Labels
Membership", acViewPreview, , "[Memnum] = " & [Memnum]
Memnum is the primary key field in the database and it is
numeric. What am I doing wrong?
-----Original Message-----

I guess I mis-understood your question.
To print out just the current record shown on the form,
just code the command button:

DoCmd.OpenReport "Report Name",
acViewPreview, , "[RecordID] = " &
[RecordID]

where [RecordID] is the unique prime key field, and is a Number datatype.

If [RecordID] is a Text datatype, then use:
[RecordID] = '" & [RecordID] & "'"

The check box does not need to be checked.
Change [RecordID] to the actual name of the record's prime key field.
Change acViewPreview to acViewNormal to print without previewing.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
Fred, I appreciate the help on this. Your code worked
great. What this does though, is print all the records
that have a check mark. I was looking at something that
will leave the checkmark in place but just print that one
record at the time it is being selected. I am trying to
send the selected customer name and address to a label
printer, instead of using a sheet of labels.
-----Original Message-----
Jim,
Make a Label report.

Make sure the check box is bound to the record.
Then code a Command Button Click event:

DoCmd.OpenReport "LabelReportName",
acViewPreview, , "[CheckBoxName] = -1"

Place a check mark in each record for which you wish to
have a label
printed.
Press the command button.

To then clear the existing check mark after printing,
add another command
button.
Name it "Clear Check Marks"

Code it's Click Event:
CurrentDb.Execute "Update TableName Set TableName.
[CheckBoxName] = 0;",
dbFailOnError

Change all the report, table and field names above to
whatever the actual
names are.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


I have a Form that is based on a query that shows
customer information, plus it has a check box that can
be
selected. I am needing a way where I can automatically
print a label when this check box is selected from the
Form. Thanks in advance.


.


.
 
Fred, I inserted your suggested code into other forms I
have made on this database, and it works like a champ! I
have one, and of course it is the one that I started and
am having trouble with, that is a little different. The
Form is based on a Query that prompts for a name or
partial name, and returns the record/s. Following is the
SQL for the query:

SELECT Membership.*, Membership.Memnum, Membership.Addr1,
Membership.Addr2, Membership.[City/State],
Membership.Zip, Membership.SSN, Membership.SPUSSN,
Membership.Location, Membership.Amount,
Membership.Register, Membership.Phone, Membership.Comments
FROM Membership
WHERE (((Membership.Name) Like [Forms]!
[F_Flind_Member_Name]![Name] & "*"));

Does this help? I really appreciate your help.


-----Original Message-----
Is MemNum included in the Form, as well as in the Report?
Are you absolutely sure it is spelled properly?
"MemNum" is not the same as "Men Num" or "Mem_Num"

The code you are using is correct if MemNum is a Number datatype.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
Fred, now I am getting an error that states Access can't
find the field 'Memnum' referred to in the expression.
Following is the code: DoCmd.OpenReport "Labels
Membership", acViewPreview, , "[Memnum] = " & [Memnum]
Memnum is the primary key field in the database and it is
numeric. What am I doing wrong?
-----Original Message-----
I am needing a way where I can automatically
print a label when this check box is selected
from
the
Form.

I guess I mis-understood your question.
To print out just the current record shown on the form,
just code the command button:

DoCmd.OpenReport "Report Name",
acViewPreview, , "[RecordID] = " &
[RecordID]

where [RecordID] is the unique prime key field, and
is a
Number datatype.
If [RecordID] is a Text datatype, then use:
[RecordID] = '" & [RecordID] & "'"

The check box does not need to be checked.
Change [RecordID] to the actual name of the record's prime key field.
Change acViewPreview to acViewNormal to print without previewing.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Fred, I appreciate the help on this. Your code worked
great. What this does though, is print all the records
that have a check mark. I was looking at something that
will leave the checkmark in place but just print
that
one
record at the time it is being selected. I am trying to
send the selected customer name and address to a label
printer, instead of using a sheet of labels.
-----Original Message-----
Jim,
Make a Label report.

Make sure the check box is bound to the record.
Then code a Command Button Click event:

DoCmd.OpenReport "LabelReportName",
acViewPreview, , "[CheckBoxName] = -1"

Place a check mark in each record for which you
wish
to
have a label
printed.
Press the command button.

To then clear the existing check mark after printing,
add another command
button.
Name it "Clear Check Marks"

Code it's Click Event:
CurrentDb.Execute "Update TableName Set TableName.
[CheckBoxName] = 0;",
dbFailOnError

Change all the report, table and field names above to
whatever the actual
names are.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


I have a Form that is based on a query that shows
customer information, plus it has a check box
that
can
be
selected. I am needing a way where I can automatically
print a label when this check box is selected
from
the
Form. Thanks in advance.


.



.


.
 
Jim,
1) Why are you using "Select Membership.*," then continuing with also naming
the fields already included when you use the * wildcard.

2) Name is a VBA reserved word and should not be used as a field or control
name.
Access gets confused.

Change the table Field name from NAME to "MemName".
Change the control on the form named NAME to "SearchName".
Then change the query to either:

SELECT Membership.*
FROM Membership
WHERE Membership.MemName Like [Forms]![F_Flind_Member_Name]![SearchName] &
"*";

Or:

SELECT Membership.Memnum, Membership.MemName,
Membership.Addr1,
Membership.Addr2, Membership.[City/State],
Membership.Zip, Membership.SSN, Membership.SPUSSN,
Membership.Location, Membership.Amount,
Membership.Register, Membership.Phone, Membership.Comments
FROM Membership
WHERE Membership.MemberName Like [Forms]![F_Flind_Member_Name]![SearchName]
& "*";

(I'v included the MemName field in the above SQL )

See the appropriate following Microsoft KnowledgeBase
article regarding Reserved words:

109312 'Reserved Words in Microsoft Access'
209187 'Acc2000: 'Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
Fred, I inserted your suggested code into other forms I
have made on this database, and it works like a champ! I
have one, and of course it is the one that I started and
am having trouble with, that is a little different. The
Form is based on a Query that prompts for a name or
partial name, and returns the record/s. Following is the
SQL for the query:

SELECT Membership.*, Membership.Memnum, Membership.Addr1,
Membership.Addr2, Membership.[City/State],
Membership.Zip, Membership.SSN, Membership.SPUSSN,
Membership.Location, Membership.Amount,
Membership.Register, Membership.Phone, Membership.Comments
FROM Membership
WHERE (((Membership.Name) Like [Forms]!
[F_Flind_Member_Name]![Name] & "*"));

Does this help? I really appreciate your help.


-----Original Message-----
Is MemNum included in the Form, as well as in the Report?
Are you absolutely sure it is spelled properly?
"MemNum" is not the same as "Men Num" or "Mem_Num"

The code you are using is correct if MemNum is a Number datatype.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
Fred, now I am getting an error that states Access can't
find the field 'Memnum' referred to in the expression.
Following is the code: DoCmd.OpenReport "Labels
Membership", acViewPreview, , "[Memnum] = " & [Memnum]
Memnum is the primary key field in the database and it is
numeric. What am I doing wrong?
-----Original Message-----
I am needing a way where I can automatically
print a label when this check box is selected from
the
Form.

I guess I mis-understood your question.
To print out just the current record shown on the form,
just code the command button:

DoCmd.OpenReport "Report Name",
acViewPreview, , "[RecordID] = " &
[RecordID]

where [RecordID] is the unique prime key field, and is a
Number datatype.

If [RecordID] is a Text datatype, then use:
[RecordID] = '" & [RecordID] & "'"

The check box does not need to be checked.
Change [RecordID] to the actual name of the record's
prime key field.
Change acViewPreview to acViewNormal to print without
previewing.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Fred, I appreciate the help on this. Your code worked
great. What this does though, is print all the records
that have a check mark. I was looking at something that
will leave the checkmark in place but just print that
one
record at the time it is being selected. I am trying to
send the selected customer name and address to a label
printer, instead of using a sheet of labels.
-----Original Message-----
Jim,
Make a Label report.

Make sure the check box is bound to the record.
Then code a Command Button Click event:

DoCmd.OpenReport "LabelReportName",
acViewPreview, , "[CheckBoxName] = -1"

Place a check mark in each record for which you wish
to
have a label
printed.
Press the command button.

To then clear the existing check mark after printing,
add another command
button.
Name it "Clear Check Marks"

Code it's Click Event:
CurrentDb.Execute "Update TableName Set TableName.
[CheckBoxName] = 0;",
dbFailOnError

Change all the report, table and field names above to
whatever the actual
names are.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


I have a Form that is based on a query that shows
customer information, plus it has a check box that
can
be
selected. I am needing a way where I can
automatically
print a label when this check box is selected from
the
Form. Thanks in advance.


.



.


.
 
Fred,
1) Don't really know why I did it that way. Just used to
it, I guess. I took out all the other fields to be
selected and it works great.

2) Changed the field name from "Name" and guess what? It
works!!!

Fred, I really appreciate the help you have given me.
Hope I can repay sometime. You may see another post like
this, because I couldn't get my message out to you this
morning, so I reposted the tread again. Thank you very
much again!!
-----Original Message-----
Jim,
1) Why are you using "Select Membership.*," then continuing with also naming
the fields already included when you use the * wildcard.

2) Name is a VBA reserved word and should not be used as a field or control
name.
Access gets confused.

Change the table Field name from NAME to "MemName".
Change the control on the form named NAME to "SearchName".
Then change the query to either:

SELECT Membership.*
FROM Membership
WHERE Membership.MemName Like [Forms]!
[F_Flind_Member_Name]![SearchName] &
"*";

Or:

SELECT Membership.Memnum, Membership.MemName,
Membership.Addr1,
Membership.Addr2, Membership.[City/State],
Membership.Zip, Membership.SSN, Membership.SPUSSN,
Membership.Location, Membership.Amount,
Membership.Register, Membership.Phone, Membership.Comments
FROM Membership
WHERE Membership.MemberName Like [Forms]! [F_Flind_Member_Name]![SearchName]
& "*";

(I'v included the MemName field in the above SQL )

See the appropriate following Microsoft KnowledgeBase
article regarding Reserved words:

109312 'Reserved Words in Microsoft Access'
209187 'Acc2000: 'Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Jim said:
Fred, I inserted your suggested code into other forms I
have made on this database, and it works like a champ! I
have one, and of course it is the one that I started and
am having trouble with, that is a little different. The
Form is based on a Query that prompts for a name or
partial name, and returns the record/s. Following is the
SQL for the query:

SELECT Membership.*, Membership.Memnum, Membership.Addr1,
Membership.Addr2, Membership.[City/State],
Membership.Zip, Membership.SSN, Membership.SPUSSN,
Membership.Location, Membership.Amount,
Membership.Register, Membership.Phone, Membership.Comments
FROM Membership
WHERE (((Membership.Name) Like [Forms]!
[F_Flind_Member_Name]![Name] & "*"));

Does this help? I really appreciate your help.


-----Original Message-----
Is MemNum included in the Form, as well as in the Report?
Are you absolutely sure it is spelled properly?
"MemNum" is not the same as "Men Num" or "Mem_Num"

The code you are using is correct if MemNum is a
Number
datatype.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Fred, now I am getting an error that states Access can't
find the field 'Memnum' referred to in the expression.
Following is the code: DoCmd.OpenReport "Labels
Membership", acViewPreview, , "[Memnum] = " & [Memnum]
Memnum is the primary key field in the database and
it
is
numeric. What am I doing wrong?
-----Original Message-----
I am needing a way where I can automatically
print a label when this check box is selected from
the
Form.

I guess I mis-understood your question.
To print out just the current record shown on the form,
just code the command button:

DoCmd.OpenReport "Report Name",
acViewPreview, , "[RecordID] = " &
[RecordID]

where [RecordID] is the unique prime key field, and is a
Number datatype.

If [RecordID] is a Text datatype, then use:
[RecordID] = '" & [RecordID] & "'"

The check box does not need to be checked.
Change [RecordID] to the actual name of the record's
prime key field.
Change acViewPreview to acViewNormal to print without
previewing.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Fred, I appreciate the help on this. Your code worked
great. What this does though, is print all the records
that have a check mark. I was looking at
something
that
will leave the checkmark in place but just print that
one
record at the time it is being selected. I am trying to
send the selected customer name and address to a label
printer, instead of using a sheet of labels.
-----Original Message-----
Jim,
Make a Label report.

Make sure the check box is bound to the record.
Then code a Command Button Click event:

DoCmd.OpenReport "LabelReportName",
acViewPreview, , "[CheckBoxName] = -1"

Place a check mark in each record for which you wish
to
have a label
printed.
Press the command button.

To then clear the existing check mark after printing,
add another command
button.
Name it "Clear Check Marks"

Code it's Click Event:
CurrentDb.Execute "Update TableName Set TableName.
[CheckBoxName] = 0;",
dbFailOnError

Change all the report, table and field names
above
to
whatever the actual
names are.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


I have a Form that is based on a query that shows
customer information, plus it has a check box that
can
be
selected. I am needing a way where I can
automatically
print a label when this check box is selected from
the
Form. Thanks in advance.


.



.



.


.
 
Back
Top