Is there anyway that I can use the text data type wth a set format ie /MM"000" and so that it will contine onto 001, 002, 0003 etc WITHOUT using the Autonumber data type
Yes,<br>You need a table to store a number, so each time the number increments one. I called it "LastNumber"<br>-----------------------------<br>'open table and get the last number used<br> Dim MyDB As Database, MySet As Recordset<br> Dim Temp1, Temp2 As Single, MyValue As String<br> Set MyDB = CurrentDb<br> <br> Set MySet = MyDB.OpenRecordset("LastNumber"<br> MySet.MoveFirst<br> MySet.Edit<br> Temp1 = Trim(Str(MySet.Fields("LastNumber"))<br> MyValue = Format(Now, "/MM" & String(3 - Len(Temp1), "0" & Temp1<br> Temp2 = Val(Temp1) + 1<br> MySet.Fields("LastNumber" = Temp2<br> MySet.Update<br> MySet.Close<br> MyDB.Close<br> <br> Text2 = MyValue<br>-------------------------------------<br><br>If you want Double quotes "" around it then change "MyValue" line to:<br>MyValue = Format(Now, "/MM" & Chr$(34) & String(3 - Len(Temp1), "0" & Temp1 & Chr$(34)<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.