Hi,I'm currently using vb8. i need help in coding.
How can I increment a number in a textbox everytime when the form is loaded?
I want that first time when the form gets loaded Company_id should appear in the textbox as NEW010101.
Second time it should appear as NEW010102.
Third time NEW010103
i use this coding which also copy a post from daniweb.com and edit
Private Function GetNextID(ByVal sID As String) As String Dim i As Integer Dim sTmp As String sTmp = Mid(sID, 6) i = Val(sTmp) + 1 sTmp = "NEW" & Format(i, "01010#") GetNextID = sTmp End Function
if i textbox1.text = GetNextID("NEW01010")
the first time i add can work ,become NEW010101, but second cant work.
how what the full coding can i read the max company_id in database and increment the id?