Solved

Update query and report printing

Posted on 2004-04-13
6
315 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

772 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