x404.co.uk
http://www.x404.co.uk/forum/

Access help
http://www.x404.co.uk/forum/viewtopic.php?f=3&t=15761
Page 1 of 1

Author:  forquare1 [ Wed Feb 01, 2012 2:11 pm ]
Post subject:  Access help

Hello all,

I've got an Access 2010 db and I'm trying to validate a first name, I'm trying to say that it should only contain letters, an apostrophe, and a hyphen, but I can't find anything that doesn't require you to snoop every key stroke...

Many thanks,

Ben

Author:  finlay666 [ Wed Feb 01, 2012 3:22 pm ]
Post subject:  Re: Access help

Regex validator? (You would probably need to do it through VBA)

Something like [a-zA-Z'-]+

I don't think you can snope a key stroke, only a completed field, otherwise every key press would fire validation

Author:  forquare1 [ Wed Feb 01, 2012 5:46 pm ]
Post subject:  Re: Access help

Cheers Finlay :D

Author:  finlay666 [ Thu Feb 02, 2012 8:39 am ]
Post subject:  Re: Access help

That is a very simple one, you probably need a more comprehensive one though

For instance you wouldn't have a hyphen/apostrophe at the start or end character
It's early, not had enough tea and as a result the way you join them escapes me...

but it would be (in a laypersons notation with partial regex)...
[a-zA-Z] + (0...+ [a-zA-Z'-]+) + [a-zA-Z]
then x'x and x-x are valid but 'xx, xx- and 'x' aren't

The above does cover you for 2 letter names though... not sure if you could validate 1 letter names (or if they exist)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/