Solved

Marking a database row as printed

Posted on 2006-11-02
8
160 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

707 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

17 Experts available now in Live!

Get 1:1 Help Now