when the value is = *****X (1 Viewer)

mymy

Registered User.
Local time
Today, 10:03
Joined
Jun 18, 2001
Messages
16
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

Registered User.
Local time
Today, 10:03
Joined
Jun 6, 2000
Messages
225
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

AWF VIP
Local time
Today, 04:03
Joined
Dec 23, 1999
Messages
619
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).]
 

Users who are viewing this thread

Top Bottom