Solved

Update query and report printing

Posted on 2004-04-13
6
296 Views
Last Modified: 2006-11-17
I would like to automatically fill a field (DatePrinted) with the current date in each record of a query after I print a report. This is a personal project for billing that I am working on as described in a previous question

www.experts-exchange.com/Databases/MS_Access/Q_20951916.html


I would like to print only the records that are marked completed and haven't been printed previously and then enter the date after the printing is done. Should I have a separate Update query that I run after printing? I am sure there would be several options in code but for now I would like to have an efficient but quick and dirty solution. Maybe with a macro? I also have these databases synched to a Palm with HanDBase which is where the charges will usually be entered so I need a method that will not corrupt that setup as well.

Pointing me in the right direction will be greatly appreciated.

--Karen
0
Comment
Question by:kcartwright
  • 3
  • 2
6 Comments
 
LVL 32

Assisted Solution

by:jadedata
jadedata earned 150 total points
ID: 10815770
Greetings kcartwright!

  This will require that you know which of the records in the database JUST got printed.  If this is based on a query this may be easy, as the query identfies which got printed.
  If there are ANY disruptions to the printing process, this accuracy of this process is then jeopardized.

  The basic code for the date field update is

  UPDATE TableName SET [PrintedOn] = Date() WHERE (< SAME CRITERIA AS REPORT IMMEDIATELY PRECEEDING >);

  If you are specifically requesting a macro, another Expert needs to draft that for you,... I don't use macros, only VBA and SQL
 
 
regards
jack
0
 
LVL 54

Accepted Solution

by:
nico5038 earned 350 total points
ID: 10815891
Hi Karen,

I see you switche to the dateprinted instead of the YesNo field :-)

Personally I never do a direct and automated update of the rows as printers might get jammed and output can be taken by another person. Thus I always display a confirmation window asking "Printing OK" and allow the user to select NO to activate the print again.
Only when responded "Yes" I issue the update query.

This can be done using a macro to execute an update query as Jack proposed.
When there is no adding of new rows after the print of the report the query can be like:
 UPDATE TableName SET [PrintedOn] = Date() WHERE IsNull([PrintedOn]);

And all new rows will be marked.

Need more info ?

Nic;o)
0
 

Author Comment

by:kcartwright
ID: 10816239
I think this will get me moving on just fine - next will probably be Report Design questions!

This is the first time I've used expert-exchange to ask my own questions - WOW, it sure is shortening my "development" time. It almost feels like cheating. :-)


--Karen
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 54

Expert Comment

by:nico5038
ID: 10816260
As long as it's no school assignment cheating this way is OK <LOL>

BTW the programmers motto always is "Better copied from a good sample as badly constructed by myself"

Nic;o)
0
 
LVL 32

Expert Comment

by:jadedata
ID: 10816291
That's ok, I'm using the questions I've answered as my list of test questions.  Is that cheating Nico??
0
 
LVL 54

Expert Comment

by:nico5038
ID: 10816399
For you that is "my pupil" <ROTFLMAO>

Nic;o)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now