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

HELP! How do I change value of field once a record is printed?

Status
Not open for further replies.

freebd99

IS-IT--Management
Aug 6, 2002
30
US
I have a checkbox (printProfile) in one of my many tables. The check box is yes/no for printing the profile of a participant. When a new profile is entered the default value for (printProfile) is set to yes. After the profile is printed how can I reset the value to no so that at the end of the day it's only printing the most recently entered profiles.

Thanks much for your help!!!
Anna
:)
 
A few questions first...

1. How do you print the profiles? Report, form, datasheet (I hope it's a report)?

If report:
2. Do you preview the report or send it directly to the printer?
3. Is it a single item report or contains more profiles?

I'm too lazy to give all solutions. [smile]



[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Thanks for responding Daniel. Yes it is a report that I preview then send to the printer. It may or may not be a single item. For example if someone didn't receive their profile in the mail and request another one printProfile will be checked so that during the next printing it may be in a group of by itself.

I look forward to getting some of your solutions. :)

Anna
 
Hmmmmmmmmmmm,

A bit of work to detect that 'it' was ACTUALLY printed, since Ms. A. doesn't usually notice the difference between "print" and "printpreview", except for the device the information is sent to.

On the other side, once the overall report is 'correct' (from the design perspective), there is usually little reason for 'printpreview' in the situation as I undestand your description.

So, I would just assume that generation of the REPORT was sufficient to identify the record / report printing and use the report recordsourct to 'immediatly' make the table change (e.g. set [printprofile] = False)

For a more robust soloution, you could use much the same approach, but replace the boolean [printprofile] with a [printdate] (as date?) and fill in hte date time a profile was 'printed'. If a new profile was necessary, just set the [printdate] to null.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
I want it to clear the printProfile when the report is previewed not so much when it is sent to the printer. Because the template for the profiles are set so their won't be any changes.

Thanks so much for your reply.

Anna
:)
 
I tried it and it doesn't work. Can you give me some more detail if you can.

Thanks,
Anna
 
How did you 'try-it'. There are many avenues through this 'city', Starting w/ what / where you are (or are familiar w/ may shorten the journey,

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
I tried it another way and it worked but It's not so sublte. I used a macro to run an update SQL command. It basically changes the value of printProfile to know once the report view is closed. The one thing that has me brainstorming new ideas is that as the report closes a message box prompts user that records are going to updated. Any ideas on how to disable the message box.

Anna
:)
 
If it's a single user database, you could instruct the report to mark the field as false when closing.

Private Sub Report_Close()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset(Me.RecordSource)
With rst
While Not .EOF
.Edit
!ToPrint = False
.Update
.MoveNext
Wend
.Close
End With
Set rst = Nothing
End Sub

or (report will open slower, as it will run an update query for every record):

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
DoCmd.SetWarnings False
DoCmd.RunSQL ("Update TableName Set ToPrint = False Where IDField = " & IDField)
DoCmd.SetWarnings True
End Sub


Good luck.

[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top