I am assuming that you are trying to prevent the ListBox from showing items that have already been printed.
I created a table (Table5) with a Yes/No field (SampleCheck), and I created a listbox on a form using the ListBox wizard (List0). For the listbox, I selected the PK, a text field, and the check field. Then I modified the query to show only those items where the check field = No, and then set the column widths to 0";1";0" so the check field was not displayed. The bound column is 1, or the primary key.
On the print button, add code to set the check to yes on the record that is being printed, then refresh the listbox, like this:
Dim rs As ADODB.Recordset
Dim sSQL As String
Dim lRecord As Long
lRecord = Me.List0 'takes the primary key of the record.
sSQL = "UPDATE Table5 SET [SampleCheck] = Yes WHERE [SampleID] = " & lRecord
Set rs = New ADODB.Recordset
rs.Open sSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
'Do Print actions here
Me.List0.Requery
This allows me to make a selection, then when I click the button, that selection disappears from the list.
The issue here is that it permanently removes them from the listbox data, so if you don't want that, then reset them to No when the form is Opened and when the form is closed with an Update Query:
I created an Update Query called qryUPDATETable5:
UPDATE Table5 SET Table5.SampleCheck = No;
Then put this code on the On Open and On Close events of the form:
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryUPDATETable5"
DoCmd.SetWarnings True
This will reset all the records so they show up in the list box until they are removed during the form session, then reset when the form is opened or closed. You could also put this code in a module and just Call Table5ToNo() on the On Close and On Open events.
Did that help?
mmcdonal
Look it up at:
http://wrox.books24x7.com