Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a counter that uses the MS Access records. I am going to explain how
I want that counter works.

I need to make a counter that initialize from 0. But after that the counter should
check the last entered Student ID and start counting starting from that. This will
help me to create an automated invoice numbering field using text data type in MS
Access database!
Posted

I'm not sure if I understand. Have you looked at using AUTOINCREMENT[^]? You can change the starting value if needed, but I'm not sure that's what you're looking for.
 
Share this answer
 
Comments
Maciej Los 28-Jun-11 15:13pm    
5! Very short and very good answer!
Vivek Krishnamurthy 28-Jun-11 15:48pm    
5!
Chiranthaka Sampath 29-Jun-11 4:35am    
Actually I want to make a automatic invoice no that depend on the last entered invoice no to the access table. Please help
Dr.Walt Fair, PE 29-Jun-11 10:45am    
OK, I've done something similar. I set up the invoice number as an AUTOINCREMENT field. You can initialize it as you please, by default it starts at 1. Every time you create and save a new invoice, the number automatically gets incremented. That way there are no duplicates and you don't need to do hardly anything at all.
Chiranthaka Sampath 1-Jul-11 13:07pm    
Thanx pal but if I used text data type instead of auto number how can I do my generating of invoice no! Because my invoice no format is 'INV######' that is why I do not use autonumber format!
Using static variables this can do easily!

Dim Static intCVal as New Integer
Dim intTotVal as New Integer
Dim intVal as New Integer

intTotVal = intCVal + intVal
 
Share this answer
 
Very diffical to undestant what you are trying to count if number of students then you select count(*) from table
 
Share this answer
 
Comments
Vivek Krishnamurthy 28-Jun-11 15:48pm    
Not a solution, should have been a comment

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900