View Full Version : when the value is = *****X


mymy
08-03-2001, 05:58 AM
HI
My field is a packet number and the user have to enter 5numbers with 1 letter..(ex: 11111a). I would like to be able to check if the user enter a "x" for the letter, whatever the number is...
Could somebody give me some code?
thanks in advance
Myriam

D-Fresh
08-03-2001, 07:02 AM
You could use the right() function.

dim strLetter as string

strLetter = Right([PacketNumber],1)

The value of the letter will then be stored in strLetter. Hope this helps.

Doug

R. Hicks
08-03-2001, 07:17 AM
Try using the example below to validate the user's entry using the control's "Before Update" event.

Private Sub YourControlName_BeforeUpdate(Cancel As Integer)
If Len(Me.ActiveControl) <> 6 Then
* ' give mesage that the user did not enter enough characters
* Cancel = True
Else
* If Not IsNumeric(Right(Me.ActiveControl, 1)) Then
* * ' give message that the user did not enter the Alpha character
* * Cancel = True
* End If
End If

HTH
RDH

[This message has been edited by R. Hicks (edited 08-03-2001).]