Updating multiple records from a list box

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

I run a report based on records I select from a list
box. Once I run the report I no longer want those
records to show in my list box. My table has a field
named printed. Its default is set to no. How would I
change it to yes after my report is generated. Ex. My
table has 5 records and the printed field is set to no. I
select 3 records from the list box. My report is
generated and know I need to update the 3 records to yes.

Any help is grealty appreciated and thank you very much.
 
Execute an Update query statement, e.g.:
strSQL = "UPDATE [Table1] SET [Printed] = TRUE WHERE [Table1].[ID] IN
(4,6,9);"
dbEngine(0)(0).Execute strSql, dbFailOnError

To create there WHERE clause for the string, loop through the ItemsSelected
collection of the list box. If you need an example of that, see:
http://members.iinet.net.au/~allenbrowne/ser-50.html
 
Thank you!
-----Original Message-----
Execute an Update query statement, e.g.:
strSQL = "UPDATE [Table1] SET [Printed] = TRUE WHERE [Table1].[ID] IN
(4,6,9);"
dbEngine(0)(0).Execute strSql, dbFailOnError

To create there WHERE clause for the string, loop through the ItemsSelected
collection of the list box. If you need an example of that, see:
http://members.iinet.net.au/~allenbrowne/ser-50.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I run a report based on records I select from a list
box. Once I run the report I no longer want those
records to show in my list box. My table has a field
named printed. Its default is set to no. How would I
change it to yes after my report is generated. Ex. My
table has 5 records and the printed field is set to no. I
select 3 records from the list box. My report is
generated and know I need to update the 3 records to yes.

Any help is grealty appreciated and thank you very
much.


.
 
Back
Top