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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto incrementing number .

Status
Not open for further replies.

uknow

MIS
Apr 27, 2003
11
MY
Hi,
Anyone can help me! I would be much appreciated if got the solution.
I have few tables consist of customer, project and Item_code.Each customer could have few projects and each project has one Item_code.Each Item_Code might have more then one testing number.The question is how do I create the auto number for each testing No of a Item_code ?

Illustration:

Item_code : ( same for one record eg. Item119 )
Qmin : (testing no range between 1 to 5)
Ot: ( same as Qmin)
autonumber : (Start at Number 1 and so on for next testing.
This Number will differ and start from Number 1 for new item_code.) -This is the No I do not know how to generate.

Qmin and Qt will have many testing.

TQ for your great advices.

 
This is a method I a while ago for a document db
My Table and Fields/controls are
Table called Doument
Controls are DocIdent,DisIdent,Project,Number,author
On exiting the field/control prior to the number I used the code below

Dim Db As Database
Dim rds As Recordset

'to set sequential number
Set Db = CurrentDb()
Set rds = Db.OpenRecordset("SELECT DISTINCTROW Max(Document.Number) AS MaxOfNumber FROM Document WHERE((Document.DocIdent = '" & [Forms]![F_Document]![DocIdent] & "') AND (Document.DisIdent = '" & [Forms]![F_Document]![DisIdent] & "') AND (Document.Project = '" & [Forms]![F_Document]![Project] & "'));", DB_OPEN_DYNASET)


Me![Number] = IIf(IsNull(rds![MaxOfNumber]), 1, rds![MaxOfNumber] + 1)
Me![Number].Requery
Author.SetFocus

Hope this helps
Hymn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top