473,809 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to reset a number field to 0 for a new invoice

14 New Member
Hi All,

I am working in Access to print Invoices. On each invoice there is a line number column which is a field to number each line for a product purchase. I would like to know if there is a way to reset the number field (line-number field) to 0 for each invoice created. This would be incremented by 1 for each product purchase. Example below:

Invoice # line number product price
0123 1 Sugar $10.00
0123 2 Rice $10.00
0123 3 Peas $5.00
0155 1 Banana $2.00
0155 2 Orange $5.00
0159 1 Peas $4.00


Thanks for your help. The above list is not format as I would like. But just picture an invoice with line numbers for each item. But when a new invoice is created the line number is reset. Also is there a way to increment the numbers beside using autonumber.
Feb 12 '09 #1
12 3874
mshmyob
904 Recognized Expert Contributor
You cannot reset the an autonumber field unless nothing is in that table then you can delete all data and compact and repair.

SHow us your schema so we can see what you are trying to do.

cheers,

@Coni
Feb 12 '09 #2
Coni
14 New Member
Hi mshmyob,

By schema are you refering to the relationship. I have attached a copy of the relationship in pdf format. As far as the autonumber, I know that will not work. I wanted to know if there were other means whether by programming or some other expression. Thank you.
Attached Files
File Type: pdf Relationships for Invoice.pdf (8.1 KB, 395 views)
Feb 12 '09 #3
mshmyob
904 Recognized Expert Contributor
Depends on you PK in your LINE table.

If your PK is just Inv_No and Prod_Code then that means each product can only appear once per invoice, therefore line number is just programatically entered. Each line number per invoice can just start at 1 and increment by 1 for each item added to invoice. No need to zero out the line numbers.

If you made Inv_No and Prod_Code and Line_Number your PK then that means a product may appear more than once on the same invoice, but again no need to zero out line numbers.

Maybe you could explain why you need to zero them out? I cannot see any reason to zero them out but I may be missing something.

cheers,
Feb 12 '09 #4
DonRayner
489 Recognized Expert Contributor
If you want line numbers to appear on the printed invoice why not just add them at the report level. The database itself doesn't require them.
Feb 12 '09 #5
NeoPa
32,579 Recognized Expert Moderator MVP
A report control (TextBox) can be set up to sum its values within a grouping. If the value is 1 every time, the effect you will get is numbered lines within the grouping. Define the grouping as the invoice and you should have what you need.

Welcome to Bytes!
Feb 13 '09 #6
mshmyob
904 Recognized Expert Contributor
I will differ with the opinion that the line numbers are not needed in the table.

You would want the line numbers in his bridge table as he has so that when looking back at an existing invoice you can sort on line number so that they always display as the line items were entered originally.

cheers,

@DonRayner
Feb 13 '09 #7
NeoPa
32,579 Recognized Expert Moderator MVP
I can't argue with that point.

A transaction management system with multiple lines per transaction does generally need a field to indicate the original order of items. Even without the Invoicing issue, this would still be required.

In such a case, this should be determined (and saved) at the time of entry.
Feb 13 '09 #8
Coni
14 New Member
Hi Mshmyob,
I think you understand exactly what I am trying to say. I really don't need to zero out the line numbers. I want for each item to start at 1 and increment by 1 for additional items. In the Line table, invoice number and line number are unique and they are the primary keys. I just want to know if there is a way to reset the number back to 1 for a new invoice number. The line numbers on each invoice are also useful for when customers are referring to an item, you can know exactly which item on the invoice they are speaking about. I have attached a better description of the structure of the database using Visio. The attached copy can be viewed as a pdf file. Is there any way to reset the line number to 1 for each new invoice and a way to programatically increment the line number for each addtional items added
Attached Files
File Type: pdf Invoice structure.pdf (7.5 KB, 403 views)
Feb 14 '09 #9
NeoPa
32,579 Recognized Expert Moderator MVP
@NeoPa
Does this not answer your question?
Feb 15 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

9
30139
by: Ken | last post by:
How can I reset the initial form variables that are set with session statements when clicking on a button? I tried this but the function was not called: <?PHP function reset_form($none) { $_SESSION = array(); } ?> <form enctype="multipart/form-data" name="company_info" method="post" action="add_pic.php">
6
4699
by: Greg | last post by:
I am trying to change the value of one field in my query based on the value in another. If Field 1 had the text "ONACCNT" then in Feild 2 I want the date to change to today's date. Any help would be great! Thanks, Greg
12
23778
by: deko | last post by:
Is there a way to reset the AutoNumber sequence? I have several tables that use the AutoNumber field as the Primary Key, and I'd like to somehow do an Import/Export that will make remove the breaks in the sequence. A few breaks in sequence is not a big deal, but I have one table with under 200 records, but the last AutoNumber PK ID field is over 1500 - due to a lot of edits....
16
20535
by: John Baker | last post by:
Hi: I know this is a strange question, but I have inherited a system where files are copied and records re auto numbered (as an index field) )frequently, and I am wondering how high the number can go without the system crashing. An ancillary question is how one resets an auto number so that the sequence starts again at 1. In the case of this file, the auto number field serves no useful purpose except as an
13
6546
by: Ron | last post by:
Hi all I'm deciding whether to use the PK also as an account number, invoice number, transaction number, etc that the user will see for the respective files. I understand that sometimes a number will be missing, which is not a problem for my purposes I don't think, but how would it be negative? Can randomly created PK autonumber fields be negative? Any way for a PK, autonumbered, *incremented* to be negative? TIA
3
11243
by: trueblue7 | last post by:
I apologize if this question has been asked before... I'm trying to reset autonumber fields back to 1. The autonumber fields are part of the composite primary keys. I followed the MS help with a temp table and append query. I can change the number to anything but 1. I'm using Access XP and saving as 2000. Any help is appreciated.
2
2752
by: junkaccount | last post by:
Hello, I currently have a field named QuoteNumber in a table named Quotes. The field is set as autonumber and is used to assign sequential numbers as users enter information in the table through a form. This number is mainly used later as reference when a customer calls our office with questions. We use the quote number to retrieve their related information through a query. This QuoteNumber field is NOT a primary key. It is not...
13
4728
by: S.Dickson | last post by:
I had an access database that i use as an ordering system. I have a form for entering customer details. When i add a new customer on the form the customer number is an auto number that appears when i type in the details. I have just moved over to mysql server with access as the front end. I have setup the sql tables with the customer number as autonumber. When i go into the form and add a new customer it does not generate the
2
1830
by: Paul Furman | last post by:
I don't know, maybe this isn't strange but someone else set up the shopping card coding I'm working with, the way it works is to get the time() in seconds like 1172693735 and that's the shopper_ID number and the shopping_cart_last_modified number is generated the same way once they check out... then an invoice number is generated by subtracting the two numbers (shopper_ID is older from when they registered). Is this strange or bad or...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7662
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.