473,327 Members | 2,094 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,327 software developers and data experts.

Auto Incremented Number Access

Hi All...

I m developing a collection record module.

In which the invoice number field should be auto incremented....

My problem is :"How can i access the current+1 invoice number in new form entry which is to be filled"...

Pls help me with u r solutions....


Thanks All
Aug 3 '07 #1
9 2863
dafodil
392 256MB
After inserting a row that generates an AUTO_INCREMENT value, you can get the value like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT LAST_INSERT_ID();
  2.  
this will generate the last value that you auto_incremented
Aug 3 '07 #2
mwasif
802 Expert 512MB
My problem is :"How can i access the current+1 invoice number in new form entry which is to be filled"...
Why do you want current+1 invoice number?

Are you looking for this?
Aug 4 '07 #3
Thanks for trying to help me....


Actually, i want the incremented value which is now assigned to the new form is visible for the executive, who fills the collection form....
Aug 6 '07 #4
After inserting a row that generates an AUTO_INCREMENT value, you can get the value like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT LAST_INSERT_ID();
  2.  
this will generate the last value that you auto_incremented

But, Can i access this value in my html form......
Aug 6 '07 #5
dafodil
392 256MB
you need to store it in a variable. A variable in a web development language and display it.

If you're using php. You can store it to a varaiable and echo it out, to display it in html.
Aug 6 '07 #6
you need to store it in a variable. A variable in a web development language and display it.

If you're using php. You can store it to a varaiable and echo it out, to display it in html.

Can u help me with example code...
Aug 6 '07 #7
dafodil
392 256MB
Expand|Select|Wrap|Line Numbers
  1. SELECT LAST_INSERT_ID();
  2.  

Are you sure that code is what you need?


Ok here is a sample in php:

Expand|Select|Wrap|Line Numbers
  1. /*let's assume it's already connected to the database*/
  2.  
  3. $result = mysql_query( "INSERT INTO `pdt_tracker` (`Track_ID`) VALUES (NULL);" );
  4. $x = mysql_result(mysql_query( 'SELECT LAST_INSERT_ID()'),0);
  5.  
  6. /*it will automatically store value of the AUTOINCREMENT column for the last INSERT in $x */
  7.  
  8. echo $x; //display the value of $x
  9.  
Aug 6 '07 #8
Expand|Select|Wrap|Line Numbers
  1. SELECT LAST_INSERT_ID();
  2.  

Are you sure that code is what you need?


Ok here is a sample in php:

Expand|Select|Wrap|Line Numbers
  1. /*let's assume it's already connected to the database*/
  2.  
  3. $result = mysql_query( "INSERT INTO `pdt_tracker` (`Track_ID`) VALUES (NULL);" );
  4. $x = mysql_result(mysql_query( 'SELECT LAST_INSERT_ID()'),0);
  5.  
  6. /*it will automatically store value of the AUTOINCREMENT column for the last INSERT in $x */
  7.  
  8. echo $x; //display the value of $x
  9.  

Thanks a lot buddy....
Aug 7 '07 #9
dafodil
392 256MB
Glad, that code helped you. Post again if you got problems.
Aug 7 '07 #10

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

Similar topics

1
by: Ryan Hubbard | last post by:
I'm inserting a record into MySQL 4.0 using Visual Basic ADO. When using the AddNew and Update method I am unable to retrieve the value of a Auto incrment field (Yes I know I can MoveLast but this...
2
by: Tom | last post by:
I am trying to store information into a table that has an auto increment field. There is currently no data in the table. Using the code below I cannot insert data into the table. I get an error...
2
by: Mike N. | last post by:
Hello- I have a database that uses an auto number field type that goes out of sync periodically. My customer gets a "cannot add record, number already in use" error message. I dump the records...
6
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I...
8
by: John | last post by:
Hi I need a auto-number field but with a letter prefix like "P1", "P2" etc. What is the way to achieve this? Is it possible to do this at table level? Thanks Regards
5
by: Phil Latio | last post by:
I have 2 virtually identical tables and wish to move data between them. Basically one table is called "live_table" and the other is named "suspended_table" and the only difference is that the...
5
by: vul | last post by:
In VB6 there is Auto Increment check box in Project Properties, which allow you have a new version every time you compile the project. Is there any easy way to have this feature in VB 2005? Some...
5
by: David Wright | last post by:
Hello Everyone I would be grateful if someone could help me with the automatic increment of a field on my subform called ‘Test_SrNo’. I am Using Microsoft Office 2000. The auto entry of the...
2
by: BobLewiston | last post by:
Most databases have multiple users. For these databases it is a good idea to auto-increment the identity column. I understand that the identity column is not incremented until the newly-created...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.