Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Label Reports Question

Status
Not open for further replies.

kstieb

Programmer
Mar 29, 2005
11
CA
I have used some neat utilities in VB and VBA for printing labels. It is basically a "label saving" feature.
What it does is two things...
First...you can (on a form) determine the number of labels you want printed for each record in the recordset. This is neat if you want a full sheet of labels for your return address for mailing letters.
Second...you can determine which label the printing starts at on the page.
The reason I really like this second option, is that you can reuse label pages. As an example...I printed off a label report (3 across, 10 down, on each page) and now have a page left over that has 14 labels on it.
Is there a way to tell the report to start printing on label number 17, and if needed, continue printing normally on a second/third/fourth page of labels?
I am using VFP9, by the way....
 
I haven't used VFP 9's label writer much yet, but what I would do in the past to start on label 14 would be to add 13 blank records to the table, thereby printing 13 'blank' labels before the 'real' records printed.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
I worked out the answer to my question.

At first, I made a second table identical to the master table, and made blank records and copied the data via a sql select statement to it.
The thing I did not like about it was the fact I was using a table to do something that a temp cursor should be able to handle. Plus over time the table would get bloated unless you constantly packed it. Not very user friendly.

Being relatively new to VFP, I spent some time reading, looking thru the forum, and came up with a much better solution. If anyone wants to add to this, or make suggestions to improve on it, be my guest....

* Label saving program
* myLabel is the label location on the page to start printing labels from.
* It is derived from user input on the report form.
IF myLabel > 1 THEN
* User wants to print labels from location other than label 1 on the sheet.
* Create a temp cursor to hold the contents of the determined number of
* blank labels.
CREATE CURSOR aMycurs ;
(id Int, last_name C(20), first_name C(20), address C(50), ;
city C(50), province C(20), postal C(7))
* Input the number of blank records into the temp cursor.
FOR nItem = 1 TO (myLabel - 1)
APPEND BLANK IN aMycurs
REPLACE id WITH (9999900 + nItem)
ENDFOR
* Merge the blank records with the data from the master table.
* Put merged records into a cursor for use with the label report.
SELECT aMycurs.id, aMycurs.last_name, aMycurs.first_name,;
aMycurs.address, aMycurs.city, aMycurs.province,;
aMycurs.postal;
FROM ;
aMycurs;
UNION ;
SELECT members.id, members.last_name, members.first_name,;
members.address, members.city, members.province,;
members.postal;
FROM ;
Data1!members;
WHERE members.deceased = .F.;
AND members.unrenewed = .F.;
AND members.life = .T.;
OR members.expires >= myMemvar;
OR members.card = 0;
ORDER BY members.last_name, members.first_name;
INTO CURSOR mycursor
REPORT FORM reports\paprc.lbx NOCONSOLE PREVIEW

ELSE
* User wishes to print labels starting on the first label on sheet.
SELECT Members.last_name, Members.first_name, Members.address,;
Members.city, Members.province, Members.postal, Members.phone,;
Members.life, Members.expires, Members.range_key, Members.key_number;
FROM data1!members;
WHERE Members.deceased = .F.;
AND Members.unrenewed = .F.;
AND Members.life = .T.;
OR Members.expires >= myMemvar;
ORDER BY Members.last_name, Members.first_name;
INTO CURSOR mycursor
REPORT FORM reports\paprc.lbx NOCONSOLE PREVIEW

ENDIF

CLEAR RESOURCES aMycurs

Now to work on a solution to print muliple copies of labels, sorted in order properly....My next midnite-oil session!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top