My Assistant
![]() ![]() |
|
|
Sep 20 2006, 06:51 AM
Post
#1
|
|
|
New Member Posts: 4 |
Hi there
I have a form which I need to enter a mobile phone base station ID which is currently in the form of "any number of numerical characters" followed by a single alphanumeric option letter eg 104A 11086B 23248D 15E etc. Technically any number of numeric characters should be allowed, but a safe limit would be 7 numeric characters and one alphanumeric at the right end of the ID. Leading zeros are not an option, as this has to mesh into reports produced by another existing system which omits the leading zeros. Short of asking users to enter spaces manually, I can't think of a way to make the input mask fill from the right instead of the left, so that I could use 9999990L If anyone has any ideas, I'd love to hear them! |
|
|
|
Sep 20 2006, 09:52 AM
Post
#2
|
|
|
VIP Emeritus Posts: 1,750 From: The Great White North |
Hi,
try this function on for size (air code coming), CODE public function validatePhone(sPhone as string) as boolean validatephone =false if not isnum(left(sphone),len(sphone)-1) then exit function if not isAlpha(right(sphone,1)) then exit function validatephone = true end function Public Function isAlpha(cChar As Integer) As Boolean 'returns if its a alphabetic character isAlpha = IIf((cChar >= 65 And cChar <= 90) Or (cChar >= 97 And cChar <= 122), True, False) End Function Public Function isNum(varTest) As Boolean Dim numTest As Long isNum = False On Error GoTo notnumber numTest = varTest If numTest <> varTest Then GoTo notnumber isNum = True Exit Function notnumber: End Function The isNum function will check if its a number or not (as a long), and the isAlpha function will check if it is a letter, lowercase or uppercase. Hope these come in handy for ya, Adam |
|
|
|
Sep 21 2006, 11:02 AM
Post
#3
|
|
|
New Member Posts: 4 |
Ahh, that makes sense,
I've not had much experience of access, so i've got this snazzy table structure all defined and I'm scratching my head to get decent forms together! I can see I'm going to have to learn VB to complete this project properly. Cheers for the help. |
|
|
|
Sep 21 2006, 12:43 PM
Post
#4
|
|
|
VIP Emeritus Posts: 1,750 From: The Great White North |
Glad I could help.
Since you're new to Access, let me point you towards this post , which will give you lots of great little tips (Scroll down to see Freakazeud's links). Good luck, Adam |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 03:00 AM |