append current record to a temp table

I am creating a shipping label program in access 2002 which uses 3 linked read only tables from a sql 2000 server. In this database I have created 2 tables "tblLabels" and "tblLabelsTemp". The form I am using is for the most part complete and uses the tblLabels table. I have two combo boxes one for job number and one for shipto line item which auto fills certain fields from the 3 tables after update. I need to, after entry of the shipping record, create labels that are used on the cartons that will be shipped out based on the information taken from the 3 linked tables that are being saved the the tblLabels table. The problem is for each record I could, base on the amount of pieces in each carton, have to print multiple labels with a "1 of 2" or "2 of 2" scenario based on a field called total labels. I would like to know and be shown what would the easiest way to do this, should I populate the temp table with a count field and duplicate the records. Thanks in advance for your help!


Kenneth MarksProgramming ManagerAsked:
Who is Participating?
9swampyConnect With a Mentor Commented:
The solution you suggest is pretty much what I'd do;

Create a temp table and build your labels report based on it
Populate at run time the temp table
Run the report to generate the 1 of 2, 2 of 2 labels

private sub createlabels(p_1stLine as string,p_2ndLine as string,p_iNumLabels as integer)
dim oRst as dao.recordset
dim gSQL as string
gSQL = "Select * from temptable"
set orst = currentdb.openrecordset(gSQL)
with orst
if not .eof and .bof then
do while not .eof
for i = 1 to num_of_labels
!1stLine =p_1stLine
!2ndLine =p_2ndLine
!iLabel = i
!iNumLabels = p_iNumLabels
docmd.openreport YourReport,acnormal
end with
set oRst = nothing
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.