Validating car registration number

Nitrous

Registered User.
Local time
Today, 04:17
Joined
Jan 23, 2003
Messages
16
Hi, Does anyone know how you would go about validating a car registration number in the new form since 2001 (eg AB01 XYZ)

Many thanks!
 
What are the validation rules? Or is that your question? :D
 
Also: for which country?

If it's the UK then they could be in a few formats and let's not forget the personalised plates.

Most European places I believe they reflect the locale.
Same with American...
 
Mile-O-Phile said:
Also: for which country?

If it's the UK then they could be in a few formats and let's not forget the personalised plates.

Most European places I believe they reflect the locale.
Same with American...

Im after the validation rules.

This is for UK car reg, excluding old reg and personalised.

Just need a way for it to validate the new XX01 XXX Reg types for all years.

It'll need to verify that the first number is either a zero or a five, that is it i think, but how would i do that?

Many thanks
 
Code:
Dim strPlateNum As String
Dim strPlateCode As String

strPlateNum = Right(Left(Me.txtPlateNum, 4), 2)
strPlateCode = Left(Me.txtPlateNum, 1)

If strPlateNum = "01" Then
    Select Case strPlateCode
        
        Case "0"
        Me.txtPlateType = "New Plate"
        
        Case "5"
        Me.txtPlateType = "New PLate"
        
        Case Else
        Me.txtPlateType = "Old Plate"
        
    End Select
End If

You can use this, i am unsure how UK plates work, but i belive this is what you want, it first checks the "01" part, then checks the front number if it is a "0" or "5", customize it to fit your needs. :D
________
Washington medical marijuana
 
Last edited:
a.sinatra said:
Code:
Dim strPlateNum As String
Dim strPlateCode As String

strPlateNum = Right(Left(Me.txtPlateNum, 4), 2)
strPlateCode = Left(Me.txtPlateNum, 1)

If strPlateNum = "01" Then
    Select Case strPlateCode
        
        Case "0"
        Me.txtPlateType = "New Plate"
        
        Case "5"
        Me.txtPlateType = "New PLate"
        
        Case Else
        Me.txtPlateType = "Old Plate"
        
    End Select
End If

You can use this, i am unsure how UK plates work, but i belive this is what you want, it first checks the "01" part, then checks the front number if it is a "0" or "5", customize it to fit your needs. :D

cool, cheers mate.

Where abouts do I put this lot?

I just tried it in the validation code box, but it said that it was wrong.
 
Nitrous said:
cool, cheers mate.

Where abouts do I put this lot?

I just tried it in the validation code box, but it said that it was wrong.

Tried it everywhere and it just keeps saying its wrong :(

Do you have any access validation code instead of VB
 
Make sure:

You have 2 text boxes....

Text field; txtPlateNum , where the plate number will be entered.

Text field; txtPlateType , this displays "New Plate" or "Old Plate" should

You would put this in the AfterUpdate of txtPlateNum.
________
Box vaporizer
 
Last edited:

Users who are viewing this thread

Back
Top Bottom