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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Q about insert blank records in printcursor

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
I ame using sheets with e.g. 27 labels on it. 9 rows with 3 labels across.
In my app I want my user give control over which label to print. (Only one label will be printed)
That way he/she can efficient use the whole sheet.

I create the printdata with an sql command which result in cursor with just one record. The datarecord.

For 27 labels my printcursor should hold 27 records.

When I want to print e.g. label 5 I need 4 blank records physically before the record which hold the data.
That way on label 5 my data will be printed.


Q:
Is there an easy way to insert blank records before my datarecord?
Or should I just append blank records and do a sort in way my datrecord is on bottom?

TIA.
-Bart
 
I do the same thing and I create a print cursor, do as many APPEND BLANK as needed to skip labels and then add the data to print.

There is the legacy command INSERT BEFORE, but I never cared enough to change to that. With a low number of records that would work, but you need to lookup the exact syntax in an older help, this is a command only included for backward compatibility.

Bye, Olaf.
 
Just for the record, the syntax of the old-style INSERT is:

Code:
INSERT BEFORE BLANK

This will insert a blank record immediately before the current record in the current work area.

But I'm only giving this information in case anyone is curious. It's better to avoid using these old commands, if only because other programmers working on your code will probably not understand them.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
The way that I do it is to have the SQL Query create the 'print-cursor' as a READWRITE cursor and I ensure that there is an additional field (something like SortFld C(1)) in it which will not be printed.

Then I INDEX ON SortFld TAG <whatever>

After that I can issue as many as needed APPEND BLANK's to the 'print-cursor' and populate the new blank record's SortFld with the appropriate values so as to get the desired record into the appropriate location within the cursor.

Finally when I issue the REPORT FORM command, the desired record will be associated with the intended Label.

Good Luck,
JRB-Bldr
 
This situation is EXACTLY the sort of thing INSERT BLANK BEFORE was intended to address.

It is truly unfortunate that it's flagged as backwards-compatible only. Commands that are so identified generally have some sort of replacement, which isn't the case here.

I think I've only used the command twice in my career (both cases exactly like this one), but wouldn't hesitate to use it when needed.

As always, use the right tool in the toolbox.
 
Thanks to everybody.
I will taken your good advices!
-Bart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top