For my user system, I require each user to have a unique id. The reading in and saving of the user data is all done, but now I'm focusing on adding new users.
In my add user dialog, I have the information fields required to create a new user, one of which is the ID (which must be unique). For this I have created a function that I thought would always give a unique id but it does not. I'll paste the code below and hopefully you can tell me what I've done wrong!!
Function getnextuserid() Dim id As String Dim unique As Boolean unique = False getnextuserid = 1 Do Until unique = True For counter = 1 To maxsize Debug.Print(getnextuserid) id = userdata(counter).id If getnextuserid = id Then unique = False getnextuserid = getnextuserid + 1 Else unique = True End If Next Loop End Function
Many thanks, James