If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Print and Update Multiple Records
Hi Folks!
We have a dbase that we use to track cutomer problems on. We have a reviewed checkbox and a filter linked to that checkboxbox. When we want to print a report, print the filter kicks in and we generate a report of all unreviewed customers. Now what we would like to do is add to that macro a function that will turn the Reviewed checkbox to Yes on all the forms we just printed in the report. It saves us the step of having to print and then go back through the forms and select the reviewed checkbox so that they are not duplicated. Currently the report is set to Preview, not just print (if that makes a difference in the solution) Any help would be grand! Cory |
#2
|
|||
|
|||
Create an Update query with the same criteria you have for your report (you
can also have the report run off a query) but have the Update To line under the Reviewed check box to be true. Then you can have a message box pop up on the On Close event of your report and run the Update Query. Something like this: Dim strMsg as String strMsg = "Update all previous records to Reviewed" IF MsgBox (strMsg,vbOKCancel,"Update")= VBOK then DoCmd.SetWarnings False DoCmd.OpenQuery "qryUpdateReviewed" DoCmd.SetWarnings True Else Exit Sub End IF Hope this helps. ) "Cory" wrote: Hi Folks! We have a dbase that we use to track cutomer problems on. We have a reviewed checkbox and a filter linked to that checkboxbox. When we want to print a report, print the filter kicks in and we generate a report of all unreviewed customers. Now what we would like to do is add to that macro a function that will turn the Reviewed checkbox to Yes on all the forms we just printed in the report. It saves us the step of having to print and then go back through the forms and select the reviewed checkbox so that they are not duplicated. Currently the report is set to Preview, not just print (if that makes a difference in the solution) Any help would be grand! Cory |
#3
|
|||
|
|||
The Message box opens, I do not receive errors, but it is not running the
query. I have tried to just run the query by itself and that works. Are all of the "" suposed to be in the code, or do I drop those? Cory "Jackie L" wrote: Create an Update query with the same criteria you have for your report (you can also have the report run off a query) but have the Update To line under the Reviewed check box to be true. Then you can have a message box pop up on the On Close event of your report and run the Update Query. Something like this: Dim strMsg as String strMsg = "Update all previous records to Reviewed" IF MsgBox (strMsg,vbOKCancel,"Update")= VBOK then DoCmd.SetWarnings False DoCmd.OpenQuery "qryUpdateReviewed" DoCmd.SetWarnings True Else Exit Sub End IF Hope this helps. ) "Cory" wrote: Hi Folks! We have a dbase that we use to track cutomer problems on. We have a reviewed checkbox and a filter linked to that checkboxbox. When we want to print a report, print the filter kicks in and we generate a report of all unreviewed customers. Now what we would like to do is add to that macro a function that will turn the Reviewed checkbox to Yes on all the forms we just printed in the report. It saves us the step of having to print and then go back through the forms and select the reviewed checkbox so that they are not duplicated. Currently the report is set to Preview, not just print (if that makes a difference in the solution) Any help would be grand! Cory |
#4
|
|||
|
|||
Yes, all the quotes should be as written. You can change the first
SetWarnings to True to see if there is an error. Let me know how it goes. "Cory" wrote: The Message box opens, I do not receive errors, but it is not running the query. I have tried to just run the query by itself and that works. Are all of the "" suposed to be in the code, or do I drop those? Cory "Jackie L" wrote: Create an Update query with the same criteria you have for your report (you can also have the report run off a query) but have the Update To line under the Reviewed check box to be true. Then you can have a message box pop up on the On Close event of your report and run the Update Query. Something like this: Dim strMsg as String strMsg = "Update all previous records to Reviewed" IF MsgBox (strMsg,vbOKCancel,"Update")= VBOK then DoCmd.SetWarnings False DoCmd.OpenQuery "qryUpdateReviewed" DoCmd.SetWarnings True Else Exit Sub End IF Hope this helps. ) "Cory" wrote: Hi Folks! We have a dbase that we use to track cutomer problems on. We have a reviewed checkbox and a filter linked to that checkboxbox. When we want to print a report, print the filter kicks in and we generate a report of all unreviewed customers. Now what we would like to do is add to that macro a function that will turn the Reviewed checkbox to Yes on all the forms we just printed in the report. It saves us the step of having to print and then go back through the forms and select the reviewed checkbox so that they are not duplicated. Currently the report is set to Preview, not just print (if that makes a difference in the solution) Any help would be grand! Cory |
#5
|
|||
|
|||
It still does not want to update them. Does the form have to be closed also
before the update can occur? There is no error when I changed the SetWarnings to True. "Jackie L" wrote: Yes, all the quotes should be as written. You can change the first SetWarnings to True to see if there is an error. Let me know how it goes. "Cory" wrote: The Message box opens, I do not receive errors, but it is not running the query. I have tried to just run the query by itself and that works. Are all of the "" suposed to be in the code, or do I drop those? Cory "Jackie L" wrote: Create an Update query with the same criteria you have for your report (you can also have the report run off a query) but have the Update To line under the Reviewed check box to be true. Then you can have a message box pop up on the On Close event of your report and run the Update Query. Something like this: Dim strMsg as String strMsg = "Update all previous records to Reviewed" IF MsgBox (strMsg,vbOKCancel,"Update")= VBOK then DoCmd.SetWarnings False DoCmd.OpenQuery "qryUpdateReviewed" DoCmd.SetWarnings True Else Exit Sub End IF Hope this helps. ) "Cory" wrote: Hi Folks! We have a dbase that we use to track cutomer problems on. We have a reviewed checkbox and a filter linked to that checkboxbox. When we want to print a report, print the filter kicks in and we generate a report of all unreviewed customers. Now what we would like to do is add to that macro a function that will turn the Reviewed checkbox to Yes on all the forms we just printed in the report. It saves us the step of having to print and then go back through the forms and select the reviewed checkbox so that they are not duplicated. Currently the report is set to Preview, not just print (if that makes a difference in the solution) Any help would be grand! Cory |
#6
|
|||
|
|||
Do you have the query name spelled correctly? In my example I showed
qryUpateReviewed but you need to put your query name at that point (in quotes). When you turn the warnings on, you should have a message pop up that you are updating the records. If you do not get that, then your query is not running. If you go back into the table is your data changed? You may want to add a Me.Requery after the End If of your code. You can have the form open with the data source and still run the update query. "Cory" wrote: It still does not want to update them. Does the form have to be closed also before the update can occur? There is no error when I changed the SetWarnings to True. "Jackie L" wrote: Yes, all the quotes should be as written. You can change the first SetWarnings to True to see if there is an error. Let me know how it goes. "Cory" wrote: The Message box opens, I do not receive errors, but it is not running the query. I have tried to just run the query by itself and that works. Are all of the "" suposed to be in the code, or do I drop those? Cory "Jackie L" wrote: Create an Update query with the same criteria you have for your report (you can also have the report run off a query) but have the Update To line under the Reviewed check box to be true. Then you can have a message box pop up on the On Close event of your report and run the Update Query. Something like this: Dim strMsg as String strMsg = "Update all previous records to Reviewed" IF MsgBox (strMsg,vbOKCancel,"Update")= VBOK then DoCmd.SetWarnings False DoCmd.OpenQuery "qryUpdateReviewed" DoCmd.SetWarnings True Else Exit Sub End IF Hope this helps. ) "Cory" wrote: Hi Folks! We have a dbase that we use to track cutomer problems on. We have a reviewed checkbox and a filter linked to that checkboxbox. When we want to print a report, print the filter kicks in and we generate a report of all unreviewed customers. Now what we would like to do is add to that macro a function that will turn the Reviewed checkbox to Yes on all the forms we just printed in the report. It saves us the step of having to print and then go back through the forms and select the reviewed checkbox so that they are not duplicated. Currently the report is set to Preview, not just print (if that makes a difference in the solution) Any help would be grand! Cory |
#7
|
|||
|
|||
Actually I eneded up fixing the problem with a macro
OpenReport w/Print preview (ther report has a filter also built into it to filter the non-reviewed) OpenQuery (my UpdateReviewed) Close (close the query without saving) The UpdateReviewed query has a Update field to Yes Criteria: No. So it goes through and just selects the current unreviewed records. Then it updates and closes. So far it seems to work. I'm going to try your fix on our backup copy and see if that recties the problem. PS It was bringing up the message that the Query is running, it just did not update the table. C "Jackie L" wrote: Do you have the query name spelled correctly? In my example I showed qryUpateReviewed but you need to put your query name at that point (in quotes). When you turn the warnings on, you should have a message pop up that you are updating the records. If you do not get that, then your query is not running. If you go back into the table is your data changed? You may want to add a Me.Requery after the End If of your code. You can have the form open with the data source and still run the update query. "Cory" wrote: It still does not want to update them. Does the form have to be closed also before the update can occur? There is no error when I changed the SetWarnings to True. "Jackie L" wrote: Yes, all the quotes should be as written. You can change the first SetWarnings to True to see if there is an error. Let me know how it goes. "Cory" wrote: The Message box opens, I do not receive errors, but it is not running the query. I have tried to just run the query by itself and that works. Are all of the "" suposed to be in the code, or do I drop those? Cory "Jackie L" wrote: Create an Update query with the same criteria you have for your report (you can also have the report run off a query) but have the Update To line under the Reviewed check box to be true. Then you can have a message box pop up on the On Close event of your report and run the Update Query. Something like this: Dim strMsg as String strMsg = "Update all previous records to Reviewed" IF MsgBox (strMsg,vbOKCancel,"Update")= VBOK then DoCmd.SetWarnings False DoCmd.OpenQuery "qryUpdateReviewed" DoCmd.SetWarnings True Else Exit Sub End IF Hope this helps. ) "Cory" wrote: Hi Folks! We have a dbase that we use to track cutomer problems on. We have a reviewed checkbox and a filter linked to that checkboxbox. When we want to print a report, print the filter kicks in and we generate a report of all unreviewed customers. Now what we would like to do is add to that macro a function that will turn the Reviewed checkbox to Yes on all the forms we just printed in the report. It saves us the step of having to print and then go back through the forms and select the reviewed checkbox so that they are not duplicated. Currently the report is set to Preview, not just print (if that makes a difference in the solution) Any help would be grand! Cory |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Text Form Field Ref in Footer Won't Update on Screen | StarWine | General Discussion | 3 | December 6th, 2004 06:17 PM |
How do I print the details view | David | Running & Setting Up Queries | 5 | August 28th, 2004 12:17 AM |
Moving records to new forms | Mark | Using Forms | 1 | July 30th, 2004 06:27 PM |