Print and Update Multiple Records

G

Guest

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
 
G

Guest

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. :blush:)
 
G

Guest

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
 
G

Guest

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.
 
G

Guest

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.
 
G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top