471,107 Members | 1,618 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Help:creating a new invoice?

Hi there i have a little problem with my invoice.

Here it is:

i have a main menu with buttons, one of my button is "Create new
invoice", when click on it a form pop up so i can enter my information
and one of the field (the user cannot change the info in it.) is
invoice #. Right now, everythime i click on "Create new invoice", the
invoice # add 1. But my problem is sometime the employee dont fill it
(for x reason) and shut it down, the nest time they will click on
"Create new invoice" the invoice # will be 1 more then the last one.
There will be a blank invoice between them.

Is there a way to get rid of this??

thx a lot.

Nov 13 '05 #1
15 5120

"No***********@hotmail.com" <ug********@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi there i have a little problem with my invoice.

Here it is:

i have a main menu with buttons, one of my button is "Create new
invoice", when click on it a form pop up so i can enter my information
and one of the field (the user cannot change the info in it.) is
invoice #. Right now, everythime i click on "Create new invoice", the
invoice # add 1. But my problem is sometime the employee dont fill it
(for x reason) and shut it down, the nest time they will click on
"Create new invoice" the invoice # will be 1 more then the last one.
There will be a blank invoice between them.

Is there a way to get rid of this??

thx a lot.

Have the employee supply required information before creating a new invoice
number.
Nov 13 '05 #2
how do i do that? any hint?

Nov 13 '05 #3
have the button that creates the invoice check that all required fields
are filled in first.

Nov 13 '05 #4
have the button that creates the invoice check that all required fields
are filled in first - before allowing an invoice to be created at all.

Nov 13 '05 #5
In message <11**********************@z14g2000cwz.googlegroups .com>,
"No***********@hotmail.com" <ug********@hotmail.com> writes
Hi there i have a little problem with my invoice.

Here it is:

i have a main menu with buttons, one of my button is "Create new
invoice", when click on it a form pop up so i can enter my information
and one of the field (the user cannot change the info in it.) is
invoice #. Right now, everythime i click on "Create new invoice", the
invoice # add 1. But my problem is sometime the employee dont fill it
(for x reason) and shut it down, the nest time they will click on
"Create new invoice" the invoice # will be 1 more then the last one.
There will be a blank invoice between them.

Is there a way to get rid of this??


It depends on how the new invoice numbers are created. What you need is
a system that creates a new invoice number in the before_insert trigger
of the form.

Are you using autonumber?

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Nov 13 '05 #6
No***********@hotmail.com wrote:
Hi there i have a little problem with my invoice.

Here it is:

i have a main menu with buttons, one of my button is "Create new
invoice", when click on it a form pop up so i can enter my information
and one of the field (the user cannot change the info in it.) is
invoice #. Right now, everythime i click on "Create new invoice", the
invoice # add 1. But my problem is sometime the employee dont fill it
(for x reason) and shut it down, the nest time they will click on
"Create new invoice" the invoice # will be 1 more then the last one.
There will be a blank invoice between them.

Is there a way to get rid of this??

thx a lot.

Is the Invoice number an autonumber field? If so, this is to be
expected. An autonumber is not a good method to use for sequential
numbers. An autonumber is GREAT as a key field to link to other tables.

If you enter anything into the form, the autonumber increments. Even if
you undo your changes, the next time the invoice form is opened, a new
number will be one more than the last time an autonumber was
incremented, whether or not the record was saved. So you can expect
holes in the sequence.

The better thing to do is make the invoice number field in your table a
LongInt number. Simply remove the Autonumber type from the table and
change it to Number, type Long. And make it the primary key.

Now you need to determine when you want the record to create new invoice
number. If ONLY ONE person is updating/creating invoices, you can do
something like
If Me.NewRecord then
Me.InvoiceNumber = Dmax("InvoiceNumber","InvoiceTable")
Endif
anytime you want. If you are going to have multiple people entering
invoice numbers at the same time, you might want to do that in the
BeforeUpdate event of the form...IOW, just prior to saving the record.
Nov 13 '05 #7

"No***********@hotmail.com" <ug********@hotmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
how do i do that? any hint?


Have your Create Invoice button display an unbound dialog box showing only
the required fields with an OK and CANCEL button. If the user clicks OK,
verify the required fields, append the data and next invoice number to the
table and open the Invoice form to the new record. You could also add a user
ID field to your invoice table to identify who created each invoice.
Nov 13 '05 #8
Yes i'm using the auto number....and not +1..

Nov 13 '05 #9
In message <11**********************@g44g2000cwa.googlegroups .com>,
"No***********@hotmail.com" <ug********@hotmail.com> writes
Yes i'm using the auto number....and not +1..


That's risky in this situation. Auditors will ask questions if they find
gaps in the invoice number sequence. It's far better to create the
invoice numbers yourself so that you have complete control over them.

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Nov 13 '05 #10
ok, but i dont want them to enter it manually, to risquy i think, and
they wont remember what was the last invoice number?

Nov 13 '05 #11
and on my form i have a Save button and a Back tu main menu button.
even if i dont save it the autonumber goes up by 1 each time.

Nov 13 '05 #12
If it's a numeric column in the table for invoice number you
can use DMax() to get the highest existing value then add 1
to it.

--
Nick Coe (UK)
Available - Will work for money :-)
http://www.alphacos.co.uk/ AccHelp + pAnimal
http://www.pjandcoe.co.uk/ Online Store

In
news:11*********************@g14g2000cwa.googlegro ups.com,
No***********@hotmail.com typed:
ok, but i dont want them to enter it manually, to risquy i
think, and they wont remember what was the last invoice
number?

Nov 13 '05 #13
In message <11**********************@f14g2000cwb.googlegroups .com>,
"No***********@hotmail.com" <ug********@hotmail.com> writes
and on my form i have a Save button and a Back tu main menu button.
even if i dont save it the autonumber goes up by 1 each time.


One way to handle this is to search the invoice table for the largest
invoice number, add one to it and then use this as the next invoice
number. If it is a large table this could be slow.

Another approach is to use a table that has one row and one field. When
you create an invoice you:

1. read the number stored there
2. add one to it
3. store the new number, overwriting the old one
4. create the invoice record using the new number

The order that you do things can be important. If the process is
interrupted or fails part way it is better to have a gap in the sequence
than to have two invoices with the same number.


--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Nov 13 '05 #14

"Bernard Peek" <ba*@shrdlu.com> wrote in message
news:YW**************@shrdlu.com...
In message <11**********************@f14g2000cwb.googlegroups .com>,
"No***********@hotmail.com" <ug********@hotmail.com> writes
and on my form i have a Save button and a Back tu main menu button.
even if i dont save it the autonumber goes up by 1 each time.


One way to handle this is to search the invoice table for the largest
invoice number, add one to it and then use this as the next invoice
number. If it is a large table this could be slow.

Another approach is to use a table that has one row and one field. When
you create an invoice you:

1. read the number stored there
2. add one to it
3. store the new number, overwriting the old one
4. create the invoice record using the new number

The order that you do things can be important. If the process is
interrupted or fails part way it is better to have a gap in the sequence
than to have two invoices with the same number.


--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

dMAX will not take long if the Invoice number is indexed.
You can't have a duplicate invoice if the invoice number is the primary key.
You will need to check that your append query succeeded before opening the
invoice form, because a 2nd user may grab the next invoice number a split
second before the 1st
Nov 13 '05 #15

"Bernard Peek" <ba*@shrdlu.com> wrote in message
news:YW**************@shrdlu.com...
In message <11**********************@f14g2000cwb.googlegroups .com>,
"No***********@hotmail.com" <ug********@hotmail.com> writes
and on my form i have a Save button and a Back tu main menu button.
even if i dont save it the autonumber goes up by 1 each time.


One way to handle this is to search the invoice table for the largest
invoice number, add one to it and then use this as the next invoice
number. If it is a large table this could be slow.

Another approach is to use a table that has one row and one field. When
you create an invoice you:

1. read the number stored there
2. add one to it
3. store the new number, overwriting the old one
4. create the invoice record using the new number

The order that you do things can be important. If the process is
interrupted or fails part way it is better to have a gap in the sequence
than to have two invoices with the same number.


--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.


Dmax would search a large table quickly if Invoice number is indexed.
Invoice number could not be duplicated if Invoice number is the primary key.
You would need to check that the append query succeeded before opening to
the new invoice. A 2nd user may grab the next number just before the 1st,
causing a key violation in the append query.
Nov 13 '05 #16

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ivan Palčić | last post: by
4 posts views Thread by Phil | last post: by
10 posts views Thread by moondaddy | last post: by
4 posts views Thread by DeanL | last post: by
2 posts views Thread by JC | last post: by

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.