Mark only those printed records

  • Thread starter Thread starter Arvin Villodres
  • Start date Start date
A

Arvin Villodres

I have a table whose data need to be printed and those
printed data must be marked
with "P" after printing. However after clicking
printpreview all the records appear but I only
need to print a selected record and mark it with "P" after
I have printed them.

This is how my table looks like.

RPTNO DETAILS PRINTED
12 Changed
23 Disected
28 Infected
31 Dissolved
32 Infected
51 Changed

I need to print record nos. 12, 23, 28, and 51 and mark
the field PRINTED with "P" after
printing them.

How am I supposed to do this?

Thank you very much for the time and the help.
 
1.Change the criteria for your report to only print records where Printed =
'P'

2. create a recordset based on the same criteria as your report

3. Print your report

4. update the printflag for all records in the recordset

Something like:

set rs = currentdb.openrecordset(qryname)

With rs
.MoveFirst

Do Until .EOF
strSQL5 = "UPDATE tablename SET tablename.PrintFlag = 'P'"
strSQL5 = strSQL5 & " WHERE primarykey = '" & rs!primarykey
& "'"
UpdateSQL:

docmd.runSQL strSQL5
.MoveNext
Loop
End With

You need to change tablename to whatever your table is, the primarykey to
whatever is unique about each record that you are printing out and qryname
to whatever your report criteria is

HTH

Ali
 
Back
Top