have two tables, a current table and an archive table. The current table is the tickets that have not been invoiced and the archive table is the tickets that have been invoiced. After invoicing, tickets are moved to an archive table and deleted from the current table. have been having problems with the queries that move the tickets back and forth, so am rebuilding the queries. and need some advice. will queries work better if put all the fields in (which is the way I previously had it) or if use the asterisk* field and the criteria fields (note: all the field names are the same from the two tables).
there are several queries involved:
one moves to from the current table to the archive table(after it is invoiced out)
one moves from the archive table to the current table by date (in case we need to see the tickets for a certain date again)
one moves from the archive table to the current table by invoice (in case we need to review that invoice number)
one moves from the archive table to the current table by automated number (special invoice number)
here are two of the queries I was previously using
This appends the Tickets and Billing to the Archive:
INSERT INTO tblDataTicketArchive ( guidDetailID, guidTKNO, guidDRID, datTicketPost, datTicketHaul, datTicketLoad, strTicketNo, dblTicketQuan, guidPER, curHaul, strNotes, strAutomated, dblTicketInvoiceNo, datTicketInvoiceDate, dblTicketStatementNo, datTicketStatementDate )
SELECT tblDataTicket.guidDetailID, tblDataTicket.guidTKNO, tblDataTicket.guidDRID, tblDataTicket.datTicketPost, tblDataTicket.datTicketHaul, tblDataTicket.datTicketLoad, tblDataTicket.strTicketNo, tblDataTicket.dblTicketQuan, tblDataTicket.guidPER, tblDataTicket.curHaul, tblDataTicket.strNotes, tblDataTicket.strAutomated, tblDataTicket.dblTicketInvoiceNo, tblDataTicket.datTicketInvoiceDate, tblDataTicket.dblTicketStatementNo, tblDataTicket.datTicketStatementDate
FROM tblDataTicket
WHERE (((tblDataTicket.dblTicketInvoiceNo)>0));
INSERT INTO tblDataBillArchive ( guidDetailID, datBillPost, datBillHaul, dblQuan, guidPER, curBill, strBillNotes, strBillPO, dblBillInvoiceNo, datBillInvoiceDate, strBillAutomated, dblBillStatementNo, datBillStatementDate, fBillInvStatePaid )
SELECT tblDataBill.guidDetailID, tblDataBill.datBillPost, tblDataBill.datBillHaul, tblDataBill.dblQuan, tblDataBill.guidPER, tblDataBill.curBill, tblDataBill.strBillNotes, tblDataBill.strBillPO, tblDataBill.dblBillInvoiceNo, tblDataBill.datBillInvoiceDate, tblDataBill.strBillAutomated, tblDataBill.dblBillStatementNo, tblDataBill.datBillStatementDate, tblDataBill.fBillInvStatePaid
FROM tblDataBill
WHERE (((tblDataBill.dblBillInvoiceNo)>0));
have to have both tickets and billing. also have companion delete queries to match. If anyone can suggest better ways of handling this, I would love to hear it!
Regina Parker
ginastar@sonet.net
there are several queries involved:
one moves to from the current table to the archive table(after it is invoiced out)
one moves from the archive table to the current table by date (in case we need to see the tickets for a certain date again)
one moves from the archive table to the current table by invoice (in case we need to review that invoice number)
one moves from the archive table to the current table by automated number (special invoice number)
here are two of the queries I was previously using
This appends the Tickets and Billing to the Archive:
INSERT INTO tblDataTicketArchive ( guidDetailID, guidTKNO, guidDRID, datTicketPost, datTicketHaul, datTicketLoad, strTicketNo, dblTicketQuan, guidPER, curHaul, strNotes, strAutomated, dblTicketInvoiceNo, datTicketInvoiceDate, dblTicketStatementNo, datTicketStatementDate )
SELECT tblDataTicket.guidDetailID, tblDataTicket.guidTKNO, tblDataTicket.guidDRID, tblDataTicket.datTicketPost, tblDataTicket.datTicketHaul, tblDataTicket.datTicketLoad, tblDataTicket.strTicketNo, tblDataTicket.dblTicketQuan, tblDataTicket.guidPER, tblDataTicket.curHaul, tblDataTicket.strNotes, tblDataTicket.strAutomated, tblDataTicket.dblTicketInvoiceNo, tblDataTicket.datTicketInvoiceDate, tblDataTicket.dblTicketStatementNo, tblDataTicket.datTicketStatementDate
FROM tblDataTicket
WHERE (((tblDataTicket.dblTicketInvoiceNo)>0));
INSERT INTO tblDataBillArchive ( guidDetailID, datBillPost, datBillHaul, dblQuan, guidPER, curBill, strBillNotes, strBillPO, dblBillInvoiceNo, datBillInvoiceDate, strBillAutomated, dblBillStatementNo, datBillStatementDate, fBillInvStatePaid )
SELECT tblDataBill.guidDetailID, tblDataBill.datBillPost, tblDataBill.datBillHaul, tblDataBill.dblQuan, tblDataBill.guidPER, tblDataBill.curBill, tblDataBill.strBillNotes, tblDataBill.strBillPO, tblDataBill.dblBillInvoiceNo, tblDataBill.datBillInvoiceDate, tblDataBill.strBillAutomated, tblDataBill.dblBillStatementNo, tblDataBill.datBillStatementDate, tblDataBill.fBillInvStatePaid
FROM tblDataBill
WHERE (((tblDataBill.dblBillInvoiceNo)>0));
have to have both tickets and billing. also have companion delete queries to match. If anyone can suggest better ways of handling this, I would love to hear it!
Regina Parker
ginastar@sonet.net