• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Marking a database row as printed

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
Sean Rhudy
Asked:
Sean Rhudy
  • 4
  • 4
1 Solution
 
dds110Commented:
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
 
Sean RhudyPresidentAuthor Commented:
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
 
dds110Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
dds110Commented:
Post your code that you currently have so I can see exactly how your doing the print job.
0
 
Sean RhudyPresidentAuthor Commented:
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
 
Sean RhudyPresidentAuthor Commented:
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
 
Sean RhudyPresidentAuthor Commented:
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
 
dds110Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now