Solved

Marking a database row as printed

Posted on 2006-11-02
8
173 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
  • 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 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

13 Experts available now in Live!

Get 1:1 Help Now