Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Help In Auto Number


hii guy's
I want to create a auto number in my referancer i set you an example
i have a article referanced : AZ01
i want create a auto number in my access database like AZ011.......
Please give me the code ,as you know i use access database with ado
thank you




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Number Verses Auto Number - With An Add/Update Query.
Hi there,
I would like to use Number and NOT the normal AUTO NUMBER. But I have a mayor problem as always the same error message comes up and therefor I can't SAVE the data.

Would anybody be able to help.

Thanks aktell

Runtime error'-2147467259(80004005)':
Operation must use Updateable query.


Code:
Private Sub ctl_GButton4_Click()
'---
'--- SAVE.
Set Cmd = New ADODB.Command

With Cmd
.ActiveConnection = ConRost
.CommandType = adCmdStoredProc

If bAdd Then
.CommandText = "sp_Add_Rostering"
Else
.CommandText = "sp_Edit_Rostering"
'--- Originaly used with Auto Number.
' .Parameters.Append cParam("@iBookingDate_ID", _
adInteger, Rs_Rostering.Fields("BookingDate_ID"))
End If

'--- The first line I used as I like to use NO AUTO NUMBER, but use _
NUMBER as ID field.
.Parameters.Append cParam("@iBookingDate_ID", adInteger, _
SetText(Me.txt_BookingDate_ID.Text))
.Parameters.Append cParam("@iClientID", adInteger, _
SetText(Me.txt_ClientID.Text))
.Parameters.Append cParam("@sClientName", adVarChar, _
SetText(Me.txt_NameRostClient.Text), 50)
.Parameters.Append cParam("@iCarerID", adInteger, _
SetText(Me.txt_CarerID.Text))
.Parameters.Append cParam("@sCarerName", adVarChar, _
SetText(Me.txt_NameRostCarer1.Text), 50)
.Parameters.Append cParam("@iBookingTime_ID", adDBTime, _
SetText(Me.txt_BookingTime_ID.Text))
.Execute
End With

Rs_Rostering.Requery
bAdd = False

'--- Date for the grid.
Set Me.DataGrid1.DataSource = Rs_Rostering

End Sub

Private Sub GetValues()
With Me
.txt_BookingDate_ID.Text = _
GetText(Rs_Rostering.Fields("BookingDate_ID"))
.txt_ClientID.Text = GetText(Rs_Rostering.Fields("Client_ID"))
.txt_NameRostClient.Text = _
GetText(Rs_Rostering.Fields("ClientName"))
.txt_CarerID.Text = GetText(Rs_Rostering.Fields("Carer_ID"))
.txt_NameRostCarer1.Text = _
GetText(Rs_Rostering.Fields("CarerName"))
.txt_BookingTime_ID.Text = _
GetText(Rs_Rostering.Fields("BookingTime_ID"))
End With
End Sub

Code:
sp_Add_Rostering:

PARAMETERS [@iBookingDate_ID] Long, [@iClientID] Long, _
[@sClientName] Text ( 50 ), [@iCarerID] Long, [@sCarerName] _
Text ( 50 ), [@iBookingTime_ID] Long;
INSERT INTO tbl_June ( BookingDate_ID, Client_ID, ClientName, _
Carer_ID, CarerName, BookingTime_ID )
VALUES ([@iBookingDate_ID], [@iClientID], [@sClientName], _
[@iCarerID], [@sCarerName], [@iBookingTime_ID]);


[color=Red]sp_Edit_Rostering:[/COLOR]

PARAMETERS [@iBookingDate_ID] Long, [@iClientID] Long, _
[@sClientName] Text ( 255 ), [@iCarerID] Long, [@sCarerName] _
Text ( 255 ), [@iBookingTime_ID] Long;
UPDATE tbl_June Set tbl_June.Client_ID = [@iClientID], _
tbl_June.ClientName = [@sClientName], tbl_June.Carer_ID = _
[@iCarerID], tbl_June.CarerName = [@sCarerName], _
tbl_June.BookingTime_ID = [@iBookingTime_ID]
WHERE (((tbl_June.BookingDate_ID)=[@iBookingDate_ID]));

Number Verses Auto Number - With An Add/Update Query.
Hi there,
I would like to use Number and NOT the normal AUTO NUMBER. But I have a mayor problem as always the same error message comes up and therefor I can't SAVE the data.

Would anybody be able to help.

Thanks aktell

Runtime error'-2147467259(80004005)':
Operation must use Updateable query.

Code:
Private Sub ctl_GButton4_Click()
'---
'--- SAVE.
    Set Cmd = New ADODB.Command
    
    With Cmd
      .ActiveConnection = ConRost
      .CommandType = adCmdStoredProc
      
      If bAdd Then
        .CommandText = "sp_Add_Rostering"
      Else
        .CommandText = "sp_Edit_Rostering"
'--- Originaly used with Auto Number.
        '.Parameters.Append cParam("@iBookingDate_ID", _
            adInteger, Rs_Rostering.Fields("BookingDate_ID"))
      End If
      
'--- The first line I used as I like to use NO AUTO NUMBER, but use _
          NUMBER as ID field.
      .Parameters.Append cParam("@iBookingDate_ID", adInteger, _
          SetText(Me.txt_BookingDate_ID.Text))
      .Parameters.Append cParam("@iClientID", adInteger, _
          SetText(Me.txt_ClientID.Text))
      .Parameters.Append cParam("@sClientName", adVarChar, _
          SetText(Me.txt_NameRostClient.Text), 50)
      .Parameters.Append cParam("@iCarerID", adInteger, _
          SetText(Me.txt_CarerID.Text))
      .Parameters.Append cParam("@sCarerName", adVarChar, _
          SetText(Me.txt_NameRostCarer1.Text), 50)
      .Parameters.Append cParam("@iBookingTime_ID", adDBTime, _
          SetText(Me.txt_BookingTime_ID.Text))
      .Execute
    End With
    
    Rs_Rostering.Requery
    bAdd = False
    
    '--- Date for the grid.
    Set Me.DataGrid1.DataSource = Rs_Rostering
    
End Sub

Private Sub GetValues()
    With Me
      .txt_BookingDate_ID.Text = _
          GetText(Rs_Rostering.Fields("BookingDate_ID"))
      .txt_ClientID.Text = GetText(Rs_Rostering.Fields("Client_ID"))
      .txt_NameRostClient.Text = _
          GetText(Rs_Rostering.Fields("ClientName"))
      .txt_CarerID.Text = GetText(Rs_Rostering.Fields("Carer_ID"))
      .txt_NameRostCarer1.Text = _
          GetText(Rs_Rostering.Fields("CarerName"))
      .txt_BookingTime_ID.Text = _
          GetText(Rs_Rostering.Fields("BookingTime_ID"))
    End With
End Sub

Code:
sp_Add_Rostering:

PARAMETERS [@iBookingDate_ID] Long, [@iClientID] Long, _
    [@sClientName] Text ( 50 ), [@iCarerID] Long, [@sCarerName] _
    Text ( 50 ), [@iBookingTime_ID] Long;
INSERT INTO tbl_June ( BookingDate_ID, Client_ID, ClientName, _
    Carer_ID, CarerName, BookingTime_ID )
VALUES ([@iBookingDate_ID], [@iClientID], [@sClientName], _
    [@iCarerID], [@sCarerName], [@iBookingTime_ID]);


sp_Edit_Rostering:

PARAMETERS [@iBookingDate_ID] Long, [@iClientID] Long, _
    [@sClientName] Text ( 255 ), [@iCarerID] Long, [@sCarerName] _
    Text ( 255 ), [@iBookingTime_ID] Long;
UPDATE tbl_June Set tbl_June.Client_ID = [@iClientID], _
    tbl_June.ClientName = [@sClientName], tbl_June.Carer_ID = _
    [@iCarerID], tbl_June.CarerName = [@sCarerName], _
    tbl_June.BookingTime_ID = [@iBookingTime_ID]
WHERE (((tbl_June.BookingDate_ID)=[@iBookingDate_ID]));

How? Auto Number, Next Number Fro Data
Hi
I am traing to make auto number

so when I do addnew I call auto number from database
and if last number was 123 I get 124 and if I cancel addnew I still get next number next time 124,

Do som now how I do this??

or can show me

Auto Number
I am using visual basic 6 to create my system. My problem is, to make a "Register No" in my form to be an auto number, so the number will be automatically appeared (start with 1, 2, 3....)and user don't have to key-in in Register No field.

Auto Number
An application I developed holds various types of business orders. The order number is assigned by the app, and it is the primary key autonumber. After about two months, I had some complaints abiout the order number changing. I checked it in code, but that number is never written only read. Plus, the order number (taken from an autonumber), got lower. Is there anything that anyone can think of that might affect an autonumber field in this manner? Thanks, Sandman

Auto Number
Question for you guys.

I have a Text Field bound via a data control to an access database.

The field i am working on is called Order Numbers and its the Primary Key set for this particular database.

What I want is, that when I click "NEW RECORD", if for example the last record was record number 500, I want when clicking the new record button, for the Order Number Text Field to appear 501.

In other words I have record 500. I just want the next Order number which would be 501 to appear automatically on the field.


This is the code that i have so far

Private Sub Data1_Reposition()

Data1.Caption = (Data1.Recordset.AbsolutePosition + 1) & " of " & (Data1.Recordset.RecordCount)

End Sub


Thx Nicky

Auto Number...
I have this code in my VB project...


Code:
Public Sub CreateDB()
Dim tdfMembers As TableDef
Dim tdfBooks As TableDef
Dim tdfPasswords As TableDef
Dim DBEng As DBEngine
Dim Wrkspce As Workspace
Dim fld As Field
Dim indx As Index
DBDirectory = App.Path & "Database"
DBName = "LibrarySystem.mdb"

On Local Error GoTo errhandler

Set Wrkspce = DBEngine.Workspaces(0)
Set DB = CreateDatabase(DBDirectory & "" & DBName, dbLangGeneral, dbVersion20)

'+++MEMBERS TABLE+++'

'---Table---'
Set tdfMembers = DB.CreateTableDef("Members")

'---Index---'
Set indx = tdfMembers.CreateIndex("MembersIDX")
indx.Primary = True
indx.Fields.Append indx.CreateField("ID Number")
tdfMembers.Indexes.Append indx

'---Fields---'
Set fld = tdfMembers.CreateField("ID Number", dbText, 10)
fld.AllowZeroLength = False
tdfMembers.Fields.Append fld
Set fld = tdfMembers.CreateField("Surname", dbText, 20)
fld.AllowZeroLength = True
tdfMembers.Fields.Append fld
Set fld = tdfMembers.CreateField("Name", dbText, 30)
fld.AllowZeroLength = True
tdfMembers.Fields.Append fld
Set fld = tdfMembers.CreateField("Home Address", dbText, 80)
fld.AllowZeroLength = True
tdfMembers.Fields.Append fld
Set fld = tdfMembers.CreateField("Office Address", dbText, 80)
fld.AllowZeroLength = True
tdfMembers.Fields.Append fld
Set fld = tdfMembers.CreateField("Home Number", dbText, 15)
fld.AllowZeroLength = True
tdfMembers.Fields.Append fld
Set fld = tdfMembers.CreateField("Mobile Number", dbText, 15)
fld.AllowZeroLength = True
tdfMembers.Fields.Append fld
Set fld = tdfMembers.CreateField("Office Number", dbText, 15)
fld.AllowZeroLength = True
tdfMembers.Fields.Append fld
Set fld = tdfMembers.CreateField("Email", dbText, 30)
fld.AllowZeroLength = True
tdfMembers.Fields.Append fld

DB.TableDefs.Append tdfMembers
DB.TableDefs.Refresh

'+++END OF MEMBERS TABLE+++'

'+++BOOKS TABLE+++'

'---Table---'
Set tdfBooks = DB.CreateTableDef("Books")

'---Index---'
Set indx = tdfMembers.CreateIndex("BooksIDX")
indx.Fields.Append indx.CreateField("Control Code")
tdfBooks.Indexes.Append indx

'---Fields---'
Set fld = tdfBooks.CreateField("Control Code", dbText, 10)
fld.AllowZeroLength = False
tdfBooks.Fields.Append fld
Set fld = tdfBooks.CreateField("Book Title", dbText, 50)
fld.AllowZeroLength = True
tdfBooks.Fields.Append fld
Set fld = tdfBooks.CreateField("Author", dbText, 30)
fld.AllowZeroLength = True
tdfBooks.Fields.Append fld
Set fld = tdfBooks.CreateField("Publisher", dbText, 30)
fld.AllowZeroLength = True
tdfBooks.Fields.Append fld
Set fld = tdfBooks.CreateField("Category", dbText, 30)
fld.AllowZeroLength = True
tdfBooks.Fields.Append fld
Set fld = tdfBooks.CreateField("Shelf Location", dbText, 10)
fld.AllowZeroLength = True
tdfBooks.Fields.Append fld
Set fld = tdfBooks.CreateField("Description", dbText, 200)
fld.AllowZeroLength = True
tdfBooks.Fields.Append fld
Set fld = tdfBooks.CreateField("Copies In", dbText, 4)
fld.AllowZeroLength = True
tdfBooks.Fields.Append fld
Set fld = tdfBooks.CreateField("Copies Out", dbText, 4)
fld.AllowZeroLength = True
tdfBooks.Fields.Append fld

DB.TableDefs.Append tdfBooks
DB.TableDefs.Refresh

'+++END OF BOOKS TABLE+++'

'+++PASSWORD TABLE+++'

'---Table---'
Set tdfPasswords = DB.CreateTableDef("Passwords")

'---Fields---'
Set fld = tdfPasswords.CreateField("Username", dbText, 20)
fld.AllowZeroLength = True
tdfPasswords.Fields.Append fld
Set fld = tdfPasswords.CreateField("Password", dbText, 20)
fld.AllowZeroLength = True
tdfPasswords.Fields.Append fld
Set fld = tdfPasswords.CreateField("Access Level", dbText, 13)
fld.AllowZeroLength = True
tdfPasswords.Fields.Append fld
Set fld = tdfPasswords.CreateField("Logged In", dbBoolean, 1)
tdfPasswords.Fields.Append fld

DB.TableDefs.Append tdfPasswords
DB.TableDefs.Refresh

'+++End of Password Table+++'

DB.Close
Set fld = Nothing
Set tdfMembers = Nothing
Set tdfBooks = Nothing
Set tdfPasswords = Nothing

Exit Sub

errhandler:
MsgBox "Error creating database!" & vbNewLine & "Please view Readme.txt for details.", vbCritical, "STOP"
Exit Sub
End Sub
'================================================================================
'================================================================================

...now on the line...
Code:
Set fld = tdfMembers.CreateField("ID Number", dbText, 10)
fld.AllowZeroLength = False
tdfMembers.Fields.Append fld
and
Code:
Set fld = tdfBooks.CreateField("Control Code", dbText, 10)
fld.AllowZeroLength = False
tdfBooks.Fields.Append fld
...I've been trying to figure out how to set it up as "AutoNumber". But I can't seem to find a property for it. Can anyone please help...?

Auto Number
I have asked a question before about this, someone asked if I have a database or not. That time I didn't have a database. Now I have a database and want to try again.

I am using VB6 and Access.

The question is I have an autonumber field in my database. Each time, the form loads, I want to get the number in a textbox incremented by 1. So I need to look up the last entry in the database, then increment 1 and bring it to the textbox control. How do I write code for this? Appreciate any help. Thanks.

Auto Number
Hi,

I want my applicant number to increase by one when I click on the addnew
button thru code.

ie. if the last record had applicant number as 5, when I click on addnew
button to add a new record the the number should increase by 1. 5 + 1 = 6.

These records are saved in the Access database. How can I get the last
number / record (applicant number)

Feroz

Auto Number
Hello Friends,

I've one field emp_no in my emp_mst table,i want to
autogenerate it so that emplyoee doesn't enter the duplicate the
nos.
What i want is when the user clicks the add command button the
number in emp_no text box should increment from its previous no.

Regards,
Prashant.

Auto Number
How to create Auto Number for my Data Field in VB.

Auto Number
I would like just to ask what is the best way of generating autonumber id without any posibilityof having a duplicate id.

note: I am using VB6 and SQL Server as my database

My id would look like this "MNLE04100001"

"MNLE" - Fixed string
"04" - year
"10" - month
"0001" - increment

thanks again.

regards
Warren

Auto Number
Is there a way in vb to generate an auto-number?

i don't want MS Access to do it. i want to generate it in vb and then i a pass all values from my form to my table.
i don't want to identify a field in Ms Access as an auto-number.

thank you,

Auto Number....
Now i have a datagrid....

What i have need to do is i wanna put "auto number" for some rows...

how can i write it?


such like NUM...

when the datagrid load,the NUM will increase from 1-.....

Auto Number
Hi There,
1. Is there any way to check the next number of the AutoNumber format of a Access table.
I want to know this for a table whish have zero records.
2. How to initialise the Access table Auto number to 1 by PROGRMATICALLY.



Dinesh Asanka

Word Auto Number Col
HI,

I have a book mark at the first row,col in a table i want to to select that entire col 0,1 0,2 0,3 etc (i.e select first then shift down arrow) then i want to auto number that col, in my efforts all the clos in the table are also auto numbered. I just want the first item in the row to be number. Hope this makes sense.

Please help

Thanks

Question About Auto-Number
I am converting a old database into Access 2000 from Lotus Approach, that currently has a record number field with values in it.

What I want to do is be able to continue to be using that field with it's values as the record number, but to have it automatically increment the record number by one once a new record has been added in Access

For example, in the Lotus database, if the last record has a record number of 1000, in the new Access 2000 database I want the record number to increment by 1, to 1001, when a new record is inserted.

Any suggestions??

Thanks

Darn Auto Number
Is there a way to check what the next auto number will be on a new record in a table? I have been going to the last record, and adding 1 to that. But then I realized that it would fail to report the correct # if someone deletes the last entry. Any ideas? The thing I am trying to do is display a FamilyID on a form, but the familyID is an autoNumber in the tables.

Auto Increament Number
hi all,
i already have a field that has a field of text in my Ms Access and is it possible for me to make it as a auto number increament field?
sample data 0001, 0002, 0003 and ....
thks in advance

Auto Number In Select
Hi!

Is there a way where in I can have an auto number of rows in my "Select" query?

For example:
My query is: "Select file_name from items"

What I want is a result Like this with 2 Columns:

1 A.doc
2 B.doc
3. C.doc
4 D.doc

IANIAN

Auto Number Problem
Hi,
i m using Access 2000 database. My problem is that i want to reset auto number field in my table. i have a field name as SrNo with auto number datatype and it poulate autometically i want it begin with 1. i can not remove that field bcz it having data. any idea?
thanks

Auto Number A Report
Am generatig a report from a table.However i need to auto number the results so that one field is increment with each successful search.This is complicated by the fact that this field is not that in any table. Any ideas are welcome.

Justus

Auto Generate Ref. Number
Hey guys,

Does anybody know how I can automaticly generate a ref. number using time and date? (it's for a program for a helpdesk) So I want a label what tells a refnumber using the time and date, something like this: 10031109 or something.
Thanks

How Can I Override The Value Of An Auto Number?
hi i have a primary key which is auto number
i want to be able to override its value

..... it cant be done can it?

Auto Number Solution (ADO)
I have seen on here a few problems with Autonumber using MsAccess. I kept running into a problem that if I had a 100 bits of data and deleted one like number 50 when I tried to add a new one there would be gaps or it would have an error of the same id. I was using the code of getting the max +1. To fix this problem I just did a query to find the missing numbers. This should work for multi and single applications if call the funtion in the save button.

I know this isn't a good way to loop but it is effective.


VB Code:
Function GetNum() counter = "1"Looper:Aado.RecordSource = "SELECT * FROM TableName WHERE ID Like '" & counter & "'"    Aado.Refresh    If Aado.Recordset.RecordCount = 1 Then        counter = counter + 1        GoTo Looper    End If    End Function


Opps I posted this in this area by accident I input it into the Database area as well.

How To Get Next Auto Number In Access 2K?
In Oracle, we can find next synonym number as synonym_name.nextval

Is the any similar way to get next Auto Number value for a field in Access?

Thanks.

Help With Auto Number In Access
hi, i have a field in my access table called contactID, it is an auto number,

Is there a way in VB i can display in a label the AutoNumber +1, (so the next number that will be used).

Cheers

Auto Number Genration
Hello Friends,

Can anyone tell me how to generate a autonumber
field,i'm using oracle 8i and my employee no. field is primary key
and i wanted it to generate auto by clicking on add command
button,if possible pl. send the code.
Thanks in advance.

Regards,
Prashant.

Auto Assign A Number
I have a project that connects to a sql server via ADO.

I want the DB to auto assign a work order # to the person that enters the work order.

This is currently in Access but I am converting it to SQL server.
Below is my access code to make this happen. it works fine.
can someone help me convert this code so that it will work with VB & Sql server.

If DCount("wrkordno", "wrkord") = 0 Then
     Me![txtWrkOrdNo] = 100
 Else
     Me![txtWrkOrdNo] = DMax("wrkordno", "wrkord") + 1
    End If

Thanks alot

DVannoy
A+,Network+,CNA
dvannoy@onyxes.com


Auto Number In Access
Hello,

Ok, basically i'm looking to see if anyone knows if Access can get data from a field from the previous record when designing the algorithm for the auto number feature. My field name i need to get from the previous record is E_endAmount, i need this in order to update the E_EndAmount field for the next record. E_EndAmount = E_endamount(previous record) + E_amount

OR

I need a way to find the previous record E_EndAmount through VB6

Thanks,

Greg Watson

           All your base are belong to me
               ( º)> ~ <(º.º)> ~ <(º )

Auto Number In Sqlserver ?
what type autonumber in sqlserver ? ( in access is autonumber ?
thanks

Auto Run Number In Datareport
  I have to print the number of record just like that 1,2,3,...... How can i do ?Please Help

Auto Generate Number
hi all..
I wish to creata a auto generate number which in range 1-50 only, how can i do it?

Eg. I create first record, then record no. is 1, second is 2, third is 3. If i delete the second record, it will save the new record as Record no. 2 in stead of 4.

Auto Number Field
Microsoft Access - Auto number field always start with 1, can I chnage the starting value of an Auto number field has it's new values property set to increment to a new number other than 1?
For example starting with value 001 instread of 1...your help will be greatly appreciated.

Auto Number Field
Hi Gurus,I need to create a table with auto number filed .
what is the sql command
Thankx in advance.

Auto Number For A Unique Identifier
Hi all

If you could help me that would be great. I have a user form that is going to have some typed values. The idea is that the user types in the values then presses save. This take these values puts them into a speadsheet with the date and time and thier user name. For now anyways.

I would like to add in an identifier for each row in column E for now

So far I have

Range(me5) = "=MAX(R[2]C[0]:R[65525]C[0])+1"

This will put in the formula what i would like is the answer to the formula to be entered into the cell

Could some one give me a pointer

Kind Regards

Paul

Repeating Auto Incrementing Number
I have an Access database that contains a field that stores an order id number when an order is placed. The field is auto incrementing. However, on more than one occasion I have seen two different tickets with the same number. How can this be and how can I avoid this ever happening again?
thanks alot,
ted

Access To ORACLE What About Auto Number?
I went out and Bought the Intelligent Converters tool...
http://www.convert-in.com/acc2ora.htm

It seems to have converted all the data over to the Oracle server.

But, what happens to the Auto Number fields now that the DB is in Oracle?

I used to insert into an Access table like so...

sqlINSERT = "INSERT INTO tblPhaseData (" & _
"PR_Index, " & _
"intPhaseSeqNum, " & _
"strPhaseName, " & _
"strPhaseDescription) "
sqlVALUES = "VALUES (" & _
"" & PR_Index & "," & _
"" & myPhaseNum & "," & _
"'" & Replace(Project.StandardPhases(X, 1), "'", "''") & "'," & _
"" & Project.StandardPhases(X, 2) & ")"

SQL = sqlINSERT & sqlVALUES
Call dbx(SQL, True)
SQL = "SELECT @@identity"
Call dbx(SQL, True)
PH_Index = CLng(rs(0).Value) ' get the Auto Number Field here



Can I use this same method going forward?
(with a new connection string of course)

Or does Oracle require me to handle things differently?

Also, I am not able to query the data using SELECT statements.
Error returned is "Table or View does not exist"


Can anyone help me better undertand what's wrong?

Thanks a bunch.

Question: SQL Auto-number 'formulas'
Hello.

I have a question. I'm using auto numbers as an ID for a table in my database and I set it to increments of one with no replication to avoid duplicate instances of the ID. However, I was wondering if there is any way I can "format" the auto-ID directly from SQL instead of coming up with some sort of algorithm then re-entering the formatted ID in the database.

So, for instance, the autonumber/ID field is "1", I want to create a "formula" so that SQL can automatically format it to, say, "StudentID1", "StudentID2", etc..

Thanks.

Auto Incrementing A Number String
I need to increment a number and retain leading zeros.

Lets say I have "A0001" - I need to add 1 to it to get "A0002".

When I reach "A0009", the next number will be "A0010".

When I reach "A0099", the next number will be "A0100"

When I reach "A0999", the next number will be "A1000"

Right now, I'm using
VB Code:
'where strNewNo current contains A0001strNewNo = Left$(strNewNo, 1) & Mid$(strNewNo, 2) + 1
This gives me "A2", but I need "A0002".

Thanks.

MSAccess Auto Number Query...
I'm using the below to insert data into a table which has a field called ID that is set to AutoNumber so for each new record that is entered the ID number increments by 1. The problem I'm having is that when I inset the data the ID field is not incrementing?


VB Code:
oConn.Open strCn 'open connectionsSQL = "INSERT into MyTable SELECT * FROM MyTableWHERE PortfolioID = " 2""'queryoConn.Execute sSQL 'execute queryoConn.Close'closeSet oConn = Nothing 'clean up  

Auto Number In A Multiuser Environment
I am using an access database as my data store. I need to be able to create an auto (unique) number - incremental. I know this option is available in access but I don't think it is very reliable. What would be the best way to do this?

The application is multiuser, should a user choose 'New' and new unique number should be assigned.

SOLVED : Serial ID(auto Number)
how i can arrange the ID numbers in ascending order .

when i delete a record ... the id serial number cannot be chnged in serial order ... it still as it is ..



thnx

Auto Number Field In MS Access
Can I reset the value of an auto-number field in an MS Access Database through VB.
My problem is that I create new fields and also delete fields therefore the autonumber field is getting very large. Any help welcome

Auto Calculate Number Of Days
my Q is suppose one person is going on leave on date i.e 2-03-06 date stored in MSAccess
form the effective date the number of days well automatically calcute day by day means 2-03-06 shows 1( text box) on 03-03-06 shows 2 like this and every day increased unless he come back form vocaton.
and when employee came back from vocation store the returne date in MSAccess and start the number of days like above methode.

Auto Show The Number Of Days
my Q is suppose one person is going on leave on date i.e 2-03-06 date stored in MSAccess
form the effective date the number of days well automatically calcute day by day means 2-03-06 shows 1( text box) on 03-03-06 shows 2 like this and every day increased unless he come back form vocaton.
and when employee came back from vocation store the returne date in MSAccess and start the number of days like above methode.


secod Q is who to to creat the hyper link from vb (lable or text box) to excel or word file (means just open excel and word file did worked and closed back to programe)

I appriciate
thanks

Generate Auto Number Starting 0
hi there,

just wanna know how to generate auto number start a 0.
e.g : member no : 00001

Smile always
"Laugh is a medicine for all sickness ...
so plz laugh whatever you do"

Auto Number Generation In SQL Server
Hi Gurus,

I post this topic already, i didn't get yet what i want .that's y i posted it again.

the above post is here
click here

I am using vb6 with SQL Server 2000.

I am having a form and in this number should be autoincremented...

Auto generated Number is like Fin/cc/ss/2002-2003/01003550

----- Here i stuck in generating [2002-2003] the year.

I have to check 1st april to 31st March..If 31st march 12.59 then the year has to be changed like 2003-2004 and for coming years too.

I want to increment my number like

01003550------>01 mentions the january month...... It automatically display the month according to current month

Pls anyone help me.

Auto Increment Of A Number According To Year....
Hi Friends,

I have a problem here,I want to increase the number like this ....
2002/1 ; 2002/2 ; 2002/3 ; 2002/4 .......
2003/1 ; 2003/2 ; 2003/3 ; 2003/4 .......
like wise.....
If I select the year from combobox then according to the year the number should increse and that should be concatinated to the year and the whole should be pasted in text box.....Using Ms-Access as a database and VB as frontend......
Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved