Paul Cooke
07-09-2007, 05:26 PM
Hi Guys me again!!
After spending the last few hours searching the forum and net for an answer I have finally conceded again that I need advice
I have a field in a table called DOB (date of birth) this is currently set as a Date / Time field
It did orignally have an input mask for short date i.e 11/11/2011 but i have removed this for now.
On my form (Patients) there is also some code in the after update properties box of DOB to calculate a persons age which is entered into another text field on the form.
What I need is a customised message box if the user enters the date incorrectly i.e 11/11/11 instead of 11/11/2011 alternativley is there a way to change what the user puts in i.e 11/11/11 to 11/11/2011 automatically after udating but keeping the code to calculate the age?
Hope this isn't to confusing...
Thanks in anticipation
Paul
John Big Booty
07-09-2007, 05:51 PM
Access should be able to deal with a date input as either, 11/11/11 or 11/11/2011
I'm not sure why your form will not accept 11/11/11 and convert to 11/11/2011, perhaps it's a hangover from your input mask.
RuralGuy
07-09-2007, 05:54 PM
Any chance of eliminating any date entry problems by using a calendar?
If so then here's a link (http://www.accessmvp.com/JConrad/accessjunkie/calendars.html) to a few.
Paul Cooke
07-09-2007, 06:17 PM
Thanks John & Ruralguy for your replies
Rural Guy those calenders are good so thank you i can see myself using them further on in the devolpement of the DB later on but with this field it will be quicker just to enter the DOB using numbers
John I have removed all instances of the Input mask which was
00/00/0000;0;_ from both the table and the form because each time I entered 11/11/11 a default Access error message came up saying the value wasn't appropriate etc... I knew what this meant but the end users will not!
So I am trying to make this as User Friendly as possible as I say once they have entered the date for access to automatically change it to the short date format 11/11/2011 (in hind sight this would be better than an error message system as per my orignal question. any ideas?
thanks again
Paul
John Big Booty
07-09-2007, 07:15 PM
Paul I think that the whilst you have removed the input mask from the design of the table, it still persists in the properties of the field on the form. If you remove the input mask from the properties of the text box in the form design, I think your form will accept dates either input as 11/11/11 or 11/11/2011.
Given that this field is for a DOB you might want to consider doing a validation check to ensure that the date is not in the future, as the date 11/05/73 will convert to 11/05/2073 rather than the correct 11/05/1973
Alternately you could force the date to be input via a date pickers as suggested by RG. Your users might not find this quite as convenient as they could potentially have to click back a substantial number of years.
Dennisk
07-09-2007, 11:09 PM
I work in the health service and I agree that for DOBs it is imperative to enter the century. I've seen too many databases where very elderly patients have a DOB in the future.
Paul Cooke
07-10-2007, 02:23 AM
Thanks guys for your responses, could you or anyone suggest how I would write the validation code for this as I have tried but it does not seem to work what ever I do !!
Thanks again
Paul
Paul Cooke
07-10-2007, 09:19 AM
Hi Guys just to let you know I have finnally worked this out - To be honest I'm not actually sure how I did :confused: it but it works hoorah !!:D
Thanks again for the replies and help though
Regards
Paul