jameshutchinson008
IS-IT--Management
Basically I have created a hardware/software database that is based around the network ID on our computers (300+) At the start of time BM (Before Me) the network ID was generated by looking in server manager for a free number. As time went on and people got lazy the server manager aspect was forgotten. So as not to have clashes in computer names the kind people who set up the computer have inadvertantly created large gaps in our numbering system. (IE to be safe lets choose computer number 1256235 when we were actually on number 50 
To fill in the gaps I am trying to automatically generate a script in VB that creates a string, compares is to the comp_num field, if the value exists the code counts in increments of one until the string doesnt match then the string is stored in comp_num field.
I have very little experience in VB but this is my best shot.
The script (following) actually generates the computer number and I can save the result into the correct field from an input form. The only thing I can't figure out is how to get the code to compare the outcome to the correct field!
Any help will be muchly appreciated, (its giving me a headache!!)

To fill in the gaps I am trying to automatically generate a script in VB that creates a string, compares is to the comp_num field, if the value exists the code counts in increments of one until the string doesnt match then the string is stored in comp_num field.
I have very little experience in VB but this is my best shot.
The script (following) actually generates the computer number and I can save the result into the correct field from an input form. The only thing I can't figure out is how to get the code to compare the outcome to the correct field!
Code:
Private Sub Label35_Click()
continue = True
Counts = 1
While continue
stringkeynumber = Right("00" + (Counts), 2)
stringkey = "21-" + comptype + "-" + stringkeynumber + division + location
If [comp_num] = stringkey Then
Counts = Counts + 1
Else
comp_num = stringkey
docmd.Save
continue = False
End If:
continue = False
Wend
End Sub
Any help will be muchly appreciated, (its giving me a headache!!)