Solved

Update query and report printing

Posted on 2004-04-13
6
340 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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.

728 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