Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto number problem

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
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
 
If you change the datatype of the field to identity and then set the seed and increment values accordingly. i.e.

create table TableName(ColumnName int, identity(100,5))

The seed value is where to begin numbering, in the example above it would be 100, then it increments each record by 5.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top