Notify Tech If Serial Is Missing Numbers

TomKat

Registered User.
Local time
Today, 09:24
Joined
Apr 24, 2008
Messages
61
I have a field that has Serial numbers from computer equipment. There are some that the serial number is incomplete. When the tech opens up the form to view the computer information, I would like it to popup a msgbox and inform the tech that the serial number needs completed. This will let the tech then focus on what is missing and hopefully fix it.

I was thinking an IF statement. Here is an example of a serial number
that is wrong and correct:

Wrong: CN-0T6116-71618-123- or
CN-0T6116-71618-

Correct: CN-0T6116-71618-123-A2C3

If it could look for the last 8 characters or last 4 or 5 characters missing that is what I need.

I want to put this on the form where the field resides. So when it loads, it sees the field is missing the values and notifies the tech.

Thanks
 
If your serialization is 100% consistent in its form, how about a format mask on the field?

-dK
 
No, its not 100% consistent because there are other serial numbers that do not meet that criteria. They could be all numbers or mixed number and letters. For the most part, those are OK. Just the serial numbers with "CN" that need to be corrected or obtained and updated.
 
Do you mean something like this:
Code:
Dim StrSN As String
StrSN = "CN-0T6116-71618-123-A2C3" 'or a me.the_serial_txt_box
If Left(StrSN, 2) = "CN" Then If Not Len(StrSN) = 24 Then MsgBox ("Invalid serial")
if the serial begins with CN then check if the length is 24, if not then warn the tech.
 
Vinzz has a good suggestion.

The reason I asked was if you did a input mask on the form control, you could set it so it wouldn't matter if it was alpha or numeric. For the mask, it would need to be consistent in where the dashes are and the length of the serial number.

For instance, for a social security number the input mask would look like:

000\-00\-0000;;_

The field would be stored in the table as 555662222 but displayed as 555-66-2222. When a user inputs data into the form control, they would be shown underscores and dashes so they know what all spaces need to be filled in and be forced to fill it all in.

-dK
 
I would put that valid control if all the serial numbers were one format. Unfortunately, it is not that way.
 
That would be my first shot, if not what Vinzz suggested would be my second.

The bit about that one is, in terms of consistency, you are limited to the length of the serial number such that if the length varied it would not work.

Another condition you could use (not knowing your set-up, et. al.) is to have several conditions for a serial number length, as an example based upon a specific part number if you have different serialization schemes based upon part numbers or some other such criteria.

-dK
 
That is my delima, different parts with different serail numbers and length. For the most part I left it a certain free length field. Just need them to realize that a serial number is missing some digits, "bring it to their attention", so they can see and fix/update.

I tried this and what Vinzz had but can't get it to work on the field.
If Me.SerialNumber = "GET SERIAL INFO" Then
MsgBox ("This Asset needs serial information obtained and updated if possible!")
Else
If Me.SerialNumber(Left(StrSN, 2)) = "CN" And Not Len(StrSN) = 24 Then
MsgBox ("This Asset needs serial information obtained and updated if possible!")
End If
End If

Just need it on the serail numbers that start with "CN" and those are like sequential numbers and are not the same from the CN-X to the last 4.
 
Try this ... I am assuming the serial number control has the default value "GET SERIAL INFO":


Code:
If Me.SerialNumber = "GET SERIAL INFO" Then
     MsgBox "This Asset needs serial information obtained and updated if possible!"
Else
     If Left(Me.SerialNumber, 2)) = "CN" And Not Len(Me.SerialNumber) = 24 Then
          MsgBox "This Asset needs serial information obtained and updated if possible!"
     End If
End If

-dK
 
I get a Compile error on this line:

If Left(Me.SerialNumber, 2)) = "CN" And Not Len(Me.SerialNumber) = 24 Then
 
DKinley you are the man! that worked. Appreciate your assist!!!!!!!
 
Ah .. yeah, I see the extra ")" now .. sorry about that.

Glad it is working for you.

-dK
 

Users who are viewing this thread

Back
Top Bottom