Solved

Marking a database row as printed

Posted on 2006-11-02
8
195 Views
Last Modified: 2010-04-23
Hello, I have a receipt program I am working on, using an access database.  There is an end of day section, where the user can click and it will print off, and add up any newly entered items that were not printed in a previous end of day journal.  The problem is, the "end of day" may not be ran everyday, or it may be ran twice a day, depending on how many receipts are entered.  What would be the best way to set this up?
0
Comment
Question by:Sean Rhudy
[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
  • 4
  • 4
8 Comments
 
LVL 8

Accepted Solution

by:
dds110 earned 250 total points
ID: 17860847
Add a field in the table as datetime and set the default value to null.

Each time you print, update the field with the current date AND time

The next time you print, check only for records that are null.

Why a DateTime field you ask?

It's a good way to track printing history.
0
 

Author Comment

by:Sean Rhudy
ID: 17861622
So if i have a column called "pdate", and I have a button named btnprint, what would the code look like to pull the rows that have a null for the "pdate" column?
0
 
LVL 8

Expert Comment

by:dds110
ID: 17862650
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM Table1 WHERE pdate IS NULL")
  'do something with the recordset
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:dds110
ID: 17862657
Post your code that you currently have so I can see exactly how your doing the print job.
0
 

Author Comment

by:Sean Rhudy
ID: 17863979
I have a program called Visual Documents, I make the prinout in that, and copy the source code in.  It manually sets the x, y points of where to print everything off.  Basically when this page loads, I want all the rows with null in the pdate column to be displayed, a few of there columns added up, and printed off. Here is what I have so far.

Imports System.Data
Public Class Endofday
    Dim con As New OleDb.OleDbConnection
    Dim sql As String
    Dim ds As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Private Sub Endofday_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/backup/receiptprogram/receiptmanagement/receipt.mdb"
        con.Open()

    End Sub
End Class
0
 

Author Comment

by:Sean Rhudy
ID: 17872411
2 questions, What would the SQL statement look like? and how can I make a statement that only displays the amount of labels that I need to display the data, some days may have 5 receipts, some may have 20.....?
0
 

Author Comment

by:Sean Rhudy
ID: 17874330
Ok here is the code I have so far.

Imports System.Data
Public Class Endofday
    Dim con As New OleDb.OleDbConnection
    Dim sql As String
    Dim ds As New DataSet
    Private Cmd As New OleDb.OleDbCommand
    Dim da As OleDb.OleDbDataAdapter
    Private Sub Endofday_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/backup/receiptprogram/receiptmanagement/receipt.mdb"
        con.Open()
        Dsendofday.Clear()
        Cmd.CommandText = "SELECT ReceiptNo, PolicyNo, pmt1, pmt2, pmt3, type1, type2, type3, total, rcvdby, firstname, lastname, typeaccount, company, checkmaker, checkno, Datercvd, notebox FROM Receiptinfo WHERE pdate = null"
        Cmd.CommandType = CommandType.Text
        da = New OleDb.OleDbDataAdapter(Cmd)
        da.Fill(Dsendofday.Receiptinfo)
    End Sub
End Class
0
 
LVL 8

Expert Comment

by:dds110
ID: 17886887
Sorry I haven't been back in a few days.  National Guard weekend.

Anyway, I'll take a look at your code tomorrow.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

687 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