473,386 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

invoicing routine problem

Back in Dec 03 I was working on an app which included invoicing.
With some help from Allen Browne I got something that has worked with no
probs.
I modifyed the origional app last March to handle a milk processing business
I am involved in.
Again this has been fine with invoice number over 500.
Last week it started producing duplicate invoice number.
The invoice table is correct but It appears to repeat the customer`s last
invoice number in the invoicedetail table.
I have not altered anything for over 2 months.

The setup on asking for an invoice is
1 Grap the details from invoice transactions table and put them in invoice
detail table

2 create a record or records in the invoicetable and the autonumber field
creates the invoice number

3 pick up the invoice number from the invoicetable and update the records
in invoicedetail with the relevant invoice number

The problem appears to be with 3

sql below
1 INSERT INTO invoicedetail ( Activitydate, Activityname, Activitydetail,
starttime, quantity, Priceeach, resourcegroup, customerid, batchid,
transactiontblid )
SELECT invtransactionsq.Activitydate, invtransactionsq.Activityname,
invtransactionsq.Activitydetail, invtransactionsq.starttime,
invtransactionsq.quantity, invtransactionsq.Priceeach,
invtransactionsq.resourcegroup, invtransactionsq.customerid, [Maxbatchid]+1
AS batchid, invtransactionsq.itemnumber
FROM batchidmax, invtransactionsq
WHERE (((invtransactionsq.Activitydate) Between
[Forms]![collectforinvoicefrm]![startdate] And
[Forms]![collectforinvoicefrm]![enddate]) AND
((invtransactionsq.quantity)<>0));
2 INSERT INTO invoicetable ( batchid, custid, invdate )
SELECT Max(invoicedetail.batchid) AS MaxOfbatchid, invoicedetail.customerid,
Date() AS Expr1
FROM invoicedetail
GROUP BY invoicedetail.customerid, Date(), invoicedetail.invoicenum
HAVING (((Max(invoicedetail.batchid))>0) AND
((invoicedetail.invoicenum)=0));

3 UPDATE invoicetable INNER JOIN invoicedetail ON invoicetable.custid =
invoicedetail.customerid SET invoicedetail.invoicenum = [invoicenumber]
WHERE (((invoicedetail.invoicenum)=0) AND ((invoicedetail.Activitydate)
Between [Forms]![collectforinvoicefrm]![startdate] And
[Forms]![collectforinvoicefrm]![enddate]));

Would be grateful for any thoughts on what is going wrong

TIA
David B
Jan 26 '06 #1
0 1171

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: peteh | last post by:
Hi All; I'm having a problem running an external routine (C language) under DB2 8.2 (FP 9) on AIX 5.3. Since the code was mostly copied from the DB2 sample library, I'm pretty sure it's sound....
2
by: William Roberts | last post by:
I am desiging an invoicing program that will do recurring billing as well as charging for any additional service at a given time. All charges will be service oriented. I am particularly concerned...
5
by: David B | last post by:
I have an app which includes invoicing, which is working fine. I am wondering how best to deal with the situation where the amount paid is different from the amount invoiced. Would it be best to...
1
by: Chris | last post by:
Hi, I have searched the internet, but havent seen any sample on large scale invoice printing. I am tasked with this project of rerieving data form a database and printing invoices on a daily...
2
by: antheana | last post by:
Hi there, NeoPa and mccarthy have helped me with some table design advice previously, but I made a bit of a boo boo. It is with regards to invoicing for a job. tblJobs tblInvoices Now, I...
0
by: aa7im | last post by:
I need the source code for an accounting/invoicing/ledger application. Are there any C#/ASP.NET application out there that are either open source or for purchase that I can obtain and utilize for...
7
by: Bob Darlington | last post by:
I'm using the following routine to call UpdateDiary() - below: Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo Form_BeforeUpdate_Error Call UpdateDiary(Me!TenantCounter,...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
2
by: pvong | last post by:
I'm a newbie. I'm using VS2008 & VB.net I have a simple site and each page uses the same sub-routine. I copy and paste to each page and that's no big deal but that can get tiresome. I was...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.