Solved

Marking a database row as printed

Posted on 2006-11-02
8
192 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:seanrhudy
[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:seanrhudy
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
Technology Partners: 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:seanrhudy
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:seanrhudy
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:seanrhudy
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

Technology Partners: 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!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

739 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