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

Selecting records to print 1

Status
Not open for further replies.

spencern

Programmer
Dec 20, 2001
78
0
0
US
Hello,
I'm working on a db that has a large list of customers in it. I am trying to figure out the best way of printing address labels only for selected customers. This is what I am thinking of doing, maybe someone else has done this and knows a better way...
Every customer record has a field "print" that is yes/no.

Have a form that will let the user search for customers by name and put a check in the print box

Have a query that would look for every record that has the print box set to yes

Print the labels

Somehow clear all of the check boxes once printing is done, either by a command button or automatically. This is the part I am really unsure about. Does anyone know how I can go about setting all the yes/no fields back to no when I'm done? I think I should be able to handle everything else...

Thanks for your help,
Spencer
 

Paste this into a new Query's SQL:

UPDATE Table1 SET Table1.CBField = False;

Change Table1 to your table name. Change CBField to the Check Box field name in the table.

Save the Query as anything you like.

To run the query after printing:

Docmd.Setwarnings False
Docmd.OpenQuery "TheNewQueryName"
Docmd.Setwarnings True

Hope this makes sense

Bill

 
Thanks Bill, the query to update works great!
Just one question about the code to run it though. Where should I put it? I have a command button that is printing the report. I used the access wizard to make that button and I tried putting your code underneath but it wouldn't work. Is this where I should be putting the code?

Thanks for your help,
Spencer
 
I think you should put it in a Button on its own. In the On Click event, just in case there is a problem printing. The user would have to re-select all the Customers.

Bill
 
Yes that makes a lot more sense, don't want to have to reselect 75 records after the paper jams...I tried on a second button and it works, Thanks again.

Spencer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top